SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2000
    Location
    Arlington, TX, USA
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know any Java, so I need to borrow someone else's code so I can have a pop-up window appear with a full size image when someone clicks on a thumbnail. I'd prefer each new picture to replace the last. Can someone direct me to some free code?

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Dead simple. Add the following to the header of any HTML file that you want to be able to link to a pop-up window from (between <HEAD> and </HEAD> ):

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
    &lt;SCRIPT LANGUAGE="JavaScript"&gt;
    &lt;!--
    function popupwin(url,w,h){
    newwin=window.open(url,'popupwin','width=' + w + ',height=' + h + ',resizable');
    newwin.focus();
    return false;
    }
    //--&gt;
    &lt;/SCRIPT&gt;
    [/code]

    Then, to create pop-up window link:

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
    &lt;A HREF="linktothis.html" onClick="return popupwin('linktothis.html',550,440);"&gt; ... &lt;/A&gt;
    [/code]

    Replace linktothis.html with the file you want to load into the popup window, replace 550 with the desired width of the window, and replace 440 with the desired height of the window.

    If the window is left open, clicking another link will load the specified file into the existing window, then bring that window to the foreground.

    Browsers that don't support JavaScript (or have it disabled) will load the file into the current window like a normal link.

    Hope this fits your needs! Oh, and for the record, this is JavaScript (code embedded in the HTML file), not Java (a separate program loaded into a Web page like an image). Java is a lot more complicated.


    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

    [This message has been edited by kyank (edited May 19, 2000).]

    [This message has been edited by kyank (edited May 22, 2000).]

  3. #3
    SitePoint Member
    Join Date
    May 2000
    Location
    Arlington, TX, USA
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, that was more than helpful. Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •