PDA

View Full Version : keep pop up on top at all times.


Dr. Web
06-21-2001, 03:53 PM
I have a password pop-up verification. If the user gets the password correct, the main window (a form) is submitted. If not-a javascript alert, then another chance to enter the password. I want the pop-up to remain on top at all times... even if the user clicks back on the main form.

any ideas?

Heres the pop up.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<script langiage=javascript>
function check(){
entry=document.form1.text1.value;
valid=document.form1.passVerify.value;
if (entry=="" || entry=="undefined"){
alert("please type in your password.");
document.form1.text1.focus();
}else if (entry != valid){
alert("Your password does not match.\nPlease re-enter your passowrd.");
document.form1.text1.focus();
}else{}
}

</script>

</head>

<body bgcolor=#cccccc>

<table width=150 height=75 border=0 cellpadding=5 cellspacing=0 bgcolor=#c0c0df>
<tr>
<td>Authenticate Password</td>
</tr>
<tr>
<td>
<form name=form1>
<input type=password name=text1></td>
</tr>
<tr>
<td>&nbsp;&nbsp;<input type=button name=submit value=submit onClick="check();" >&nbsp;&nbsp;&nbsp;&nbsp;<input type=reset value=reset name=reset></td>
</tr>
</table>
<input type=hidden name=passVerify value=pw>
</form>
</body>
</html>

Dr. Web
06-21-2001, 07:15 PM
adding the following code keeps the password pop-up on top at all times.


<script language=javascript>
//starts a timer, and always keeps the password pop-up on top//
var TimerNew = setTimeout('look_at_me();', 500);
function look_at_me(){
document.form1.text1.focus();
doAgain();
}
function doAgain(){
document.form1.text1.focus();
var TimerNew = setTimeout('look_at_me();', 500);
}
</script>

Dr. Web
06-21-2001, 07:16 PM
I have been answering my own questions a lot lately! ha!

Mark
06-21-2001, 07:29 PM
:) lol...

Boa
07-05-2001, 07:36 PM
Dr. Web, thanks for being such a javascript god!...I've been looking for an answer to this question for some time...

So, here you have suggested a way that a password box can stay on top. I have created a game which initially appears in a pop-up window. As the game plays on, there are times when certain activities pop-up into additional windows. It's essential that these windows aren't accidentally closed or moved behind one another for the game to progress smoothly and logically.

My question is: is there a script that will keep the topmost window focused at all times, until you are given a button that allows you to close it? So that no other browser or pop-up window is clickable?

Thanks for any help you can provide. Of course if the good Dr. is busy, this question is open to anyone who feels so inclined to answer!

Dr. Web
07-06-2001, 04:00 PM
the script I posted will achieve that...... except that you can't do much with other windows while it is running. That sort of limits you a bit....