Dom Leonard wrote:
Eric Osman wrote:
When I run the following html file on netscape, and the button is
clicked, the new window pops BEHIND all my other windows.
How can I easily fix this html file so the window comes up in front
(like a standard alert window would) ?
[original repeated for cut and paste]
<html><head><sc ript><!--
function showWin() {
var popWin=window.o pen("","Pop","w idth=600,height =100,resizable= yes");
var hh="<HTML><HEAD ><TITLE>Answe r</TITLE></HEAD>";
hh+="<BODY><for m><textarea cols=30 rows=3>You may highlight or edit";
hh += "</textarea></form></BODY></HTML>";
popWin.document .write(hh);
popWin.document .close();
}
// --></script></head><button type=button
onmousedown='sh owWin();'>Press to create popup window</button></html>
Hi Eric, sorry to answer my own post, but my previous response was
bugging me because I hadn't needed to go to such lengths before.
Using your posted code above, there is something very strange about the
BUTTON element behavior in Mozilla - after opening the window, mouse
over and out of the BUTTON element causes button up and down motion as
if processing of the entire click sequence has been disrupted by opening
the window using mousedown. I'm not about to submit a bug report, but
strongly suspect you are looking for workaround code for this behavior.
The first recommendation is to change the event used to call showWin
from onmousedown to onclick. Most of the problems go away immediately,
with the added advantage the user can cancel click action by dragging
the mouse out of the button.
If onmousedown must be retained as the trigger, then changing the BUTTON
element to an INPUT element (leaving type the same) improves things
greatly under Mozilla.
The general observation remains that generating the same page a second
time will not bring it to the front if the user has not closed it since
opened. This is where closing an already opened window, as performed in
the previous post, can be useful.
Hope this is of slightly more use :)
Cheers,
Dom