www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] NEED HELP with POPUP CODE

  1. #1
    Join Date
    Aug 2009
    Posts
    5

    resolved [RESOLVED] NEED HELP with POPUP CODE

    I am trying to have a photo gallery where you click on a thumbnail and it automatically changes the larger image in the cell next to it. That function is working. I am now trying to add a popup feature on the larger image and I cant seem to get it to work. Please tell me what is wrong with my code...Thank you

    Code in header
    function changeImage(filename,filename2,txt){
    document.getElementById('mainimage').src=filename;
    document.getElementById('image2').src=filename2;
    document.getElementById('ImgTxt').innerHTML=txt;

    }

    function popUp(popupimage) {
    newwindow=window.open(popupimage.value,"name","height=500,width=500");
    if (window.focus) {newwindow.focus()}
    return false;
    }
    </script>

    Code in Body
    <table width="800" border="0" align="center">
    <tr bgcolor="#000000">
    <td width="52"><img src="images/bluehills_t.jpg" width="50" height="50" class="thumb" onclick="changeImage('images/bluehills.jpg','images/bluehills_pu.jpg','Blue Hills')" /></td>
    <td>&nbsp;</td>
    <td rowspan="3" align="center" width="645" bgcolor="#000000" style="padding-top:2px;"><span name="image2" id="image2" /><img src="images/bluehills.jpg" name="mainimage" width="200" height="200" id="mainimage" onClick="popUp(image2)"/><br />
    <br /> <span id="ImgTxt" class="text">Blue Hills</span> </td>
    </tr>
    </table>

  2. #2
    Join Date
    Nov 2003
    Location
    Worthington, OH, USA
    Posts
    3,634
    Change the window.open statement to read:

    newwindow=window.open(popupimage,"name","height=500,width=500");

    and the onclick for mainimage to read:

    onclick="popUp(this.src)"
    54 68 65 42 65 61 72 4D 61 79

  3. #3
    Join Date
    Aug 2009
    Posts
    5
    Thanks a ton it WORKED!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles