Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

page loading fails with popup function

Status
Not open for further replies.

leehinkleman

Programmer
Feb 14, 2002
83
NZ
This link,
<a href="javascript:void(0);" onClick="javascript:wO(this,'Halfback',714,265)">Halfback</a>,
if clicked while the page is loading, causes incomplete page loading.
Using a non-javascript href(like href="#" or href="#Halfback" allows the page to finish loading, but I just wanted to eliminate the effects of the page jumping to locations within the page with href="#" or href="#Halfback".
The function wO is

function wO(t,n,w,h){
tl=t;
nam=n;
wid=w;
hei=h;
if(wok<1){
setTimeout("wO(tl,nam,wid,hei)",999);
return;
}
if(pup){
pup.close();
}
t=n.replace(/_/g," ");
wp=w+20;
hp=h+60;
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){
open();
writeln('<html>');
writeln('<head><title>'+t+'</title></head>');
writeln('<body>');
writeln('<center>');
writeln('<b><a href="javascript:self.close()">Close Window</a></b>');
writeln('<img src="'+n+'" width='+w+' height='+h+' alt="'+t+'"><br><b>'+t+'</b>');
writeln('</center>');
writeln('</body>');
writeln('</html>');
close();
}
pup.focus();
}

and variable wok is assigned a value of 0, but is assigned a value of 1 when the page body loads, with the intention of waiting until the page was loaded, before allowing the popup.
With the href="#", this works, with the annoying page jumps.
Can those page jumps be eliminated without using href="javascript:void(0);", which could cause more catastrophic failure? Thanks for your advice.
 
I thought I'd already tried this, which now seems to have worked to stop the page jumping, and without causing the page loading failure:

<a href="#" onClick="javascript:wOthis,'Halfback',714,265);return false">Halfback</a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top