I am trying to create a gallery page, that uses an array to open the pictures into a popup window pic_open.html.
The image and description I selected then is opened in the popup window.
I did receive the following code but it doesnt seem to work for me ??? Have I missed something. Please help.
<SCRIPT LANGUAGE=”JavaScript”>
function crtImage(img,desc,x,y) {
this.img=img;
this.desc=desc;
this.x=x;
this.y=y;
// optional preload of image comment out if not needed
z=new Image(); z.src=img;
}
var myImages = new Array(
new crtImage(‘production_pic_0.jpg’,’description of image 0′,400,600),
new crtImage(‘production_pic_1.jpg’,’description of image 1′,500,475),
new crtImage(‘production_pic_2.jpg’,’description of image 2′,300,243)
)
function newWindow(idx) { // note the extra space, for description for example
window.open(‘pic_open.html?’+idx,’win’+idx,’width=’+(myImages[idx].y+20)+’,height=’+myImages[idx].x+40);
}
</SCRIPT>
<td width=”25%”><a href=”#”
onClick=”newWindow(0); return false”><img src=”graphics/thumb_pic_0.jpg”
width=”117″ height=”75″ border=”0″></a></td>
<td width=”25%”><a href=”#”
onClick=”newWindow(1); return false”><img src=”graphics/thumb_pic_1.jpg”
width=”117″ height=”75″ border=”0″></a></td>
then in the pic_open.html have
<script>
passed = location.search.substring(1);// drop the leading “?”
document.write(‘<center><img
src=”‘+opener.myImages[passed].img+'”><br>’+opener.myImages[passed].desc+'</center>’)
</script>