leehinkleman
Programmer
The following code works ok in IE4+ and Mozilla Firebird in Linux, but works once only in Konqueror on Linux, and I've been told it works once only for Safari on Macs.
The arguments for function wO() are (this,name,width,height)
just so I could use the name of trout fly patterns to make simple links to their .jpg images.
The variable bl has an initial value of 0 and is re-assigned a value of 1 when the page body loads.
function X() was intended to keep only 1 popup window at a time on top of the main window. For that idea, I tried re-assigning a another variable from 0 to 1 when the body of the popup page unloaded, to try to determine if a popup window was already open, but then all the photo popups seemed to fail in IE6.
Could someone please tell me why this javascript is failing in Safari and Konqueror? Thanks for your help.
pup="";
function X(){
if(pup!=""){
pup.close();
}
}
bl=0;
function wO(tl,n,w,h){
if(bl<1){
tl.blur();
return;
}
X();
t=n.replace(/_/g," ");
wp=w+20;
hp=h+40;
n="z='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+wp+',height='+hp;
pup=window.open('','',z);
with(pup.document){
writeln('<html>');
writeln('<head><title>'+t+'</title></head>');
writeln('<body>');
writeln('<center><img src="'+n+'" width='+w+' height='+h+' alt="'+t+' trout fly"><br><b>'+t+'</b></center>');
writeln('</body>');
writeln('</html>');
close();
}
pup.focus();
}
The arguments for function wO() are (this,name,width,height)
just so I could use the name of trout fly patterns to make simple links to their .jpg images.
The variable bl has an initial value of 0 and is re-assigned a value of 1 when the page body loads.
function X() was intended to keep only 1 popup window at a time on top of the main window. For that idea, I tried re-assigning a another variable from 0 to 1 when the body of the popup page unloaded, to try to determine if a popup window was already open, but then all the photo popups seemed to fail in IE6.
Could someone please tell me why this javascript is failing in Safari and Konqueror? Thanks for your help.
pup="";
function X(){
if(pup!=""){
pup.close();
}
}
bl=0;
function wO(tl,n,w,h){
if(bl<1){
tl.blur();
return;
}
X();
t=n.replace(/_/g," ");
wp=w+20;
hp=h+40;
n="z='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+wp+',height='+hp;
pup=window.open('','',z);
with(pup.document){
writeln('<html>');
writeln('<head><title>'+t+'</title></head>');
writeln('<body>');
writeln('<center><img src="'+n+'" width='+w+' height='+h+' alt="'+t+' trout fly"><br><b>'+t+'</b></center>');
writeln('</body>');
writeln('</html>');
close();
}
pup.focus();
}