I have an html page with a bunch of pictures (pic.html). All of the images are thumbnails of larger photos. I also have another html page which is a pop-up window essentially (popup.html) (it's a standard html page that I've set to a smaller width/height by using javascript). The popup.html page has 2 divs in it, one with the area that I'm trying to populate dynamically with the full size image of the link that the user clicked on, and the other with the selfClose button in it. The effect I'm going for is when the user clicks the link on a thumbnail, the popup should pop-up and have the top div populate with the larger image, and then when the user hits the close button, and then hits the next thumbnail link, the same popup.html window pops-up with the new 2nd larger image in that first div. Hopefully that makes sense...
So here's my code. Mind you that I've tried various iterations of this, so there's been a lot of trial and error...
pic.html relevant code (just 2 examples used of like 150 pics):
[HTML]<p><a href="images/pics/pic125.jpg" rel="external" onclick="popupwin();"><img src="images/pics/pic125tn.jpg" alt="pic125" width="100" height="125" /></a><br />
Caption Text</p>
<p><a href="images/pics/pic126.jpg" rel="external" onclick="popupwin();"><img src="images/pic/pic126tn.jpg" alt="pic126" width="100" height="125" /></a><br />
Caption Text</p>[/HTML]
popup.html relevant code:
[HTML]<div id="picarea" style="width:600px; height:550px;"></div>
<div id="closebutton" style="width:600px; height:25px; padding-top:10px; text-align:center;"><input type="button" value="Close Window" style="padding:2px; font-size:14px; text-transform:uppercase; font-weight:bold;" onclick="self.close();" /></div>[/HTML]
javascript:
Expand|Select|Wrap|Line Numbers
- function popupwin() {
- var popone = document.getElementsByTagName("a");
- for (var i=0; i<popone.length; i++) {
- var picpop = popone[i];
- if (picpop.getAttribute("rel") == "external")
- window.open('popup.html','foo','height=560,width=600,scrollbars=1,resizable=1,toolbar=1,location=1,s tatus=1');
- }
- }