Jump to content

Communicating With Opening Page


nicolet

Recommended Posts

I have index pages with photo thumbnails, e.g.:<body onload="ini();"><img src="thumbnails/090602-1350-zurich.jpg" alt="description-0" /><img src="thumbnails/090602-1356-zurich.jpg" alt="description-1" /><img src="thumbnails/090602-1403-zurich.jpg" alt="description-2" /><img src="thumbnails/090602-1421-zurich.jpg" alt="description-3" /></body>and a .js file:function ini() { for (i = 0; i < document.images.length; i++) { document.images.id = i; document.images.setAttribute('onclick','showLargeImg(this.id);'); }}function showLargeImg(id) { var im = document.getElementById(id); var winHeight = screen.availHeight; var winWidth = winHeight * im.width / im.height; var imgHeight = winHeight-40; var src = im.src.replace('thumbnails','images').replace('jpg','png'); var newWindow; if (!newWindow || newWindow.closed) { newWindow = window.open("", "new", 'toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes'); var newContent = '<html><head><title>' + im.alt + '</title></head>'; newContent += '<body onload="window.moveTo(50,50); window.resizeTo(' + winWidth + ',' + winHeight + ');" onclick="window.close();">'; newContent += '<a href="image_full.html"><img src=' + src + ' height="' + imgHeight + '" alt="" /></a>'; newContent += '</body></html>'; newWindow.document.write(newContent); newWindow.document.close(); } else if (newWindow.focus) /* window is already open and focusable, so bring it to the front */ { newWindow.focus(); }}Clicking in the large image closes the large image window: onclick="window.close();"Instead, I would like clicking in the large image to display the next img from the index page. What do I have to replace the "window.close()" with?(Credit: The above script is inspired from "JavaScript & DHTML Cookbook" by Danny Goodman)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...