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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a new window and keep it on top.

Status
Not open for further replies.

TheZombie

Programmer
Jul 10, 2001
17
US
I have used window.open() to open a new window and I would like that window to stay on top until the user clicks an ok button. Before the user can click the ok button, I need to gather some information via a text box on the page. I have read numerous posts that say to put onblur=window.focus() in the <BODY> tag to keep the window on top. This works fine as long as there are no text boxes, radio buttons, etc. in the window. If I use onblur=window.focus() the user cannot click inside the textbox, hence I cannot get the information that I need. Does anyone have a solution for this problem that doesn't use .showModalDialog()?
 
Well try the following. Even though i use the onBlur in the body i still get the focus on the text boxes. Try it and let me know if it was helpful

<body onBlur=&quot;blurred()&quot;>

<script>
var timer = '';
function blurred() {
timer = setTimeout('self.focus()',1);
}

function focused() {
if (timer != '')
clearTimeout(timer);
}
</script>


;-)
 
The window stays on top, but I still have the same problem. I can click in the text area and the cursor stays there, but I cannot type anything.
 
I got it working. Inside each control I place onblur=&quot;blurred()&quot; and onfocus=&quot;focused()&quot;. Works great. Thanks nitinkhanna!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top