My problem is this. I have taken a thumbnail script designed for one image and incorporated it for 12 images. Whenever I click on any of the thumbnais, they work sometimes and other times I have to click on different parts of the thumbnail to get it to open in a new window. The new window always opens, but some times it is empty. So, I close it and try again. Sometimes it will put the thumbnail in the new window on the second try and sometimes it might take 4 or 5 trys. And it sometimes only puts the larger image in the new window if I click on the thumbnail in a specific location. Enclosed is the javascript I am using. I have put each of the 12 pictures in an html <DIV STYLE code. Since I am new to javascript, I don't understand why the new window opens everytime, but sometimes without the larger image. I would appreciate any help. Here is the javascript for just 1 thumbnail opened in a new window.
<!-- TWO STEPS TO INSTALL THUMBNAIL VIEWER:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Anders Jennerberg (<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->) -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! <!-- m --><a class="postlink" href="http://javascript.internet.com">http://javascript.internet.com</a><!-- m --> -->
<!-- Begin
function ViewImage(ifile,ix,iy,ititle) {
var win;
var sWidth;
var sHeight;
var NS = (document.layers) ? 1 : 0;
win = window.open("","imageviewer","width="+ix+",height="+iy+",menubar=no,toolbar=no");
if (NS) {
sWidth = win.innerWidth;
sHeight = win.innerHeight;
} else {
sWidth = win.document.body.clientWidth;
sHeight = win.document.body.clientHeight;
}
if(sWidth!=ix || sHeight!=iy) {
win.close();
setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);
return;
}
win.document.open();
win.document.write("<html><head><title>"+ititle+"</title>");
win.document.write("</head><body>");
win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
win.document.write("<img src=http://www.webdeveloper.com/forum/archive/index.php/"+ifile+"></div></body></html>");
win.document.close();
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<a href="javascript:ViewImage('http://javascript.internet.com/img/thumbnail-viewer/apartment-large.jpg',576,303,'An Apartment')"><img src=http://www.webdeveloper.com/forum/archive/index.php/"apartment-small.jpg" width=288 height=152 border=1></a>
<br>
or
<br>
<a href="javascript:ViewImage('http://javascript.internet.com/img/thumbnail-viewer/apartment-large.jpg',576,303,'An Apartment')">View the apartment</a>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href=http://www.webdeveloper.com/forum/archive/index.php/"http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.72 KB -->
<!-- TWO STEPS TO INSTALL THUMBNAIL VIEWER:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Anders Jennerberg (<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->) -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! <!-- m --><a class="postlink" href="http://javascript.internet.com">http://javascript.internet.com</a><!-- m --> -->
<!-- Begin
function ViewImage(ifile,ix,iy,ititle) {
var win;
var sWidth;
var sHeight;
var NS = (document.layers) ? 1 : 0;
win = window.open("","imageviewer","width="+ix+",height="+iy+",menubar=no,toolbar=no");
if (NS) {
sWidth = win.innerWidth;
sHeight = win.innerHeight;
} else {
sWidth = win.document.body.clientWidth;
sHeight = win.document.body.clientHeight;
}
if(sWidth!=ix || sHeight!=iy) {
win.close();
setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);
return;
}
win.document.open();
win.document.write("<html><head><title>"+ititle+"</title>");
win.document.write("</head><body>");
win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
win.document.write("<img src=http://www.webdeveloper.com/forum/archive/index.php/"+ifile+"></div></body></html>");
win.document.close();
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<a href="javascript:ViewImage('http://javascript.internet.com/img/thumbnail-viewer/apartment-large.jpg',576,303,'An Apartment')"><img src=http://www.webdeveloper.com/forum/archive/index.php/"apartment-small.jpg" width=288 height=152 border=1></a>
<br>
or
<br>
<a href="javascript:ViewImage('http://javascript.internet.com/img/thumbnail-viewer/apartment-large.jpg',576,303,'An Apartment')">View the apartment</a>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href=http://www.webdeveloper.com/forum/archive/index.php/"http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.72 KB -->