Log in

View Full Version : pop up window with each image swap



robertatdetour
07-23-2009, 11:16 PM
Hello everyone,
need some assistance with a pop up while making images swap. As I have on my page listed below, if you click on any image it swaps with the larger image, but I can not figure out how to make the image that may be showing to go into a pop up window. my webpage is listed below and the source code below that.


www.detourgearzone.com/catrbebo1lbp.html


[CODE]</table>
<SCRIPT LANGUAGE="JavaScript">
var aryImages = new Array(2);

aryImages[0] = "http:/lib/yhst-29728507864769/camelbak-5l-black-lg.jpg";
aryImages[1] = "http:/lib/yhst-29728507864769/camelbak-5l-pink-lg.jpg";
aryImages[2] = "http:/lib/yhst-29728507864769/camelbak-5l-grey-lg.jpg";
aryImages[3] = "http:/lib/yhst-29728507864769/camelbak-5l-red-lg.jpg";
aryImages[4] = "http:/lib/yhst-29728507864769/camelbak-5l-blue-lg.jpg";
aryImages[5] = "http:/lib/yhst-29728507864769/camelbak-5l-purple-lg.jpg";

for (i=0; i < aryImages.length; i++) {
var preload = new Image();
preload.src = aryImages[i];
}
function swap(imgIndex) {
document['imgMain'].src = aryImages[imgIndex];
}
// End -->
</script>

<BODY onLoad="swap(0);">

<br>
<br>
<table>
[ICODE]


Any help is greatly appreciated

Beverleyh
07-24-2009, 01:33 PM
Try this script where you can write content directly into a popup without creating a series of new pages to hold each image:
http://www.quirksmode.org/js/popup.html#writing

Looking at your page, I'm not sure why you'd want to open up each image in a new popup though - surely the image swap as you have it looks nicer?

Beverley