Scout720
07-19-2009, 10:55 PM
The ViewImage JavaScript is an important part of my web site. I use it to display larger images of products, difinitions of features and finish sample photos. These images are different sizes. The size of the window is specified in the link to the image. The window remains open until the user closes it. It has fuctioned properly in all earlier IE versions.
With IE8 the window opens at the correct size, but does not load the image, and then immediately re-closes, then opens again and this continues in a flashing sequence! The only way to stop it is to back out of the page.
This is the part of the Script posted in the Header:
[CODE]
<SCRIPT LANGUAGE="JavaScript">
<!-- 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="+ifile+"></div></body></html>");
win.document.close();
}
// End -->
</script>
This is an example of the link code that activates it and is posted in the body of the page:
[CODE]
<a href="javascript:ViewImage('../cat/20530.jpg',456,351,'20530 Product')"><img src="../images/20530p.jpg" alt="20530 Product"></a>
Any help to make this code workable in IE8 would greatly be appreciated. I am at my wits end!:eek:
Thanks a bunch!
Scout720
With IE8 the window opens at the correct size, but does not load the image, and then immediately re-closes, then opens again and this continues in a flashing sequence! The only way to stop it is to back out of the page.
This is the part of the Script posted in the Header:
[CODE]
<SCRIPT LANGUAGE="JavaScript">
<!-- 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="+ifile+"></div></body></html>");
win.document.close();
}
// End -->
</script>
This is an example of the link code that activates it and is posted in the body of the page:
[CODE]
<a href="javascript:ViewImage('../cat/20530.jpg',456,351,'20530 Product')"><img src="../images/20530p.jpg" alt="20530 Product"></a>
Any help to make this code workable in IE8 would greatly be appreciated. I am at my wits end!:eek:
Thanks a bunch!
Scout720