[thelist] JavaScript Pop-up Window

.jeff jeff at members.evolt.org
Mon Nov 19 21:41:46 CST 2001


beau,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Beau Hartshorne
>
> is called from an <a> tag, like so: <a
> href="javaScript:okDialogHIGH();">High Speed</a>, in
> IE 6/Win2k, the popup window gets opened in the
> background. This problem does not appear at all in
> Netscape 6.2.
>
> Here's the page: http://www.edgemont.tv/backlot/post.asp
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

i'm guessing they caused by the following code in the documents opened in
the popup:

<script language="JavaScript">
<!--

function MM_CloseWindow() { //v2.0
  window.blur();
}
//-->
</script>

<body onLoad="MM_CloseWindow()">

get ride of that function and the call to it in the onload event handler and
i believe this problem will go away.

another thing -- is there any reason to alienate non-js enabled users?  i
sure don't see one.  to fix this, move the function call to the onclick
event handler and add a return false statement.  place the location of the
page in your href attribute to make it available to your non-js users.

<a
 href="video/high/post.html"
 onclick="okDialogHIGH(); return false"
>High</a>

or, combine both functions into one and pass the url of the document you
want to open in the new window.

function openWin(wLoc)
{
  var newWin = window.open(winLoc, 'popup',
'resizable,scrollbars,height=200,width=325');
  if(newWin.focus) newWin.focus();
}

then, you can call it like this:

<a
 href="video/high/post.html"
 onclick="newWin(this.href); return false"
>High</a>

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list