Forum Moderators: open

Message Too Old, No Replies

Creating a pseudo-modal dialog window

Can't get onBlur to fire

         

Lance

6:04 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



I'm trying to create a modal dialog window using window.open but I can't get it to stay on top. I'm using window.open instead of showModalDialog because I need the contents to be generated from within the code rather than coming from an external file.

In my example code, the first method recognizes onBlur properly and the popup stays on top. Because the contents are from and external file however, the method won't work in my application. The second method creates exactly the same popup window using document.write's. In this case, onBlur never fires.

What can I do to get the second method to work like the first?

Thanks.

Source of Test1.html:

<script type="text/javascript">
function openWin() {
var popWin = window.open("Test2.html", "popWin", "width=300, height=150");
}

function createWin() {
var popWin = window.open("", "popWin", "width=300, height=150");
popWin.document.writeln("<body onblur='window.focus();'>");
popWin.document.writeln("<p>Some Stuff</p>");
popWin.document.writeln("</body>");
}
</script>

<a href="#" onclick="openWin(); return false;">Open the Popup</a><br />
<a href="#" onclick="createWin(); return false;">Create the Popup</a>

Source of Test2.html:

<body onblur='window.focus();'>
<p>Some Stuff</p>
</body>

Lance

11:14 am on Nov 8, 2004 (gmt 0)

10+ Year Member



Anyone?