[thelist] JavaScript Pop-up Window

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


> 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

<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.

 onclick="okDialogHIGH(); return false"

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',
  if(newWin.focus) newWin.focus();

then, you can call it like this:

 onclick="newWin(this.href); return false"

good luck,


jeff at members.evolt.org

More information about the thelist mailing list