Click to See Complete Forum and Search --> : Popup won't work in Netscape 7.1 (works in IE & NS 4.7)??


pkeberly
11-10-2003, 09:06 PM
Thanks, I have an online archive of pics:

http://www.bloomlakefarms.com/pa2000_1.html

I call a JS popup function passing the image name, size and title from a thunmbnail link.

Simple enough, but I wanted it to refresh on top of the thumbnails when a new TN is selected. I hacked my way into a solution, only to find Netscape 7.1 hates it!! amazingly, it works in both NS 4.7 and IE 6.0.

(stolen from Anders Jennerberg)
<head>
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+",left=200,top=160,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><SCRIPT TYPE='text/javascript'>");
win.document.write('window.focus();</SCRIPT></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();
</head>

<body>
<a href="javascript:ViewImage('picture_to_show.jpg',640,480,'popup_title')">

The original code was borrowed, I used their format of using JS to create an HTML page on the fly?? I added "window.focus()" to the popup code with document.write{}. It's like JS writing JS? and to my suprize, it works! (Except for NS 7.1, poop!)

I've battled with this for days, my brain is a raisin! I know this is going to be an easy one...
Anybody have a clue what I can do? please!!!

Thanks again, Paul