HumanError
07-16-2003, 02:13 PM
I am currently trying to create a modal window for my web application. I have gotten this to work in IE, but I am having trouble getting it working in netscape.
I have read several articles on the web that claim they have done this, and most of them work on IE, but all of them fail on Netscape.
The way I have gone about this is using the onFocus in the body tag of the parent window to check if the child popup is on top.
This method keeps the child popup on top in both Netscape and IE, but produces a rather odd effect in Netscape. After the focus is called upon the child popup, text fields in forms on the pop are inaccessable by mouse click (though I can still tab through the fields). I checked the textfield.disabled value and saw that it was set properly, even though I could not type in.
The following 2 pages are my test samples.
<html>
<head>
<title>This is the main window</title>
<script language="JavaScript">
PopUp = null;
function NewPopUp(location)
{
PopUp = window.open(location,'new_window','height=200,width=200');
}
function CheckForOpenWindow()
{
if (PopUp!=null)
{
this.blur();
PopUp.focus();
PopUp.document.form.status.disabled=false;
PopUp.document.form.status.value=PopUp.document.form.status.readOnly;
//PopUp.alert('Please close the popup window you were working on.');
}
}
</script>
</head>
<body onFocus="CheckForOpenWindow();">
This form is for testing with popup window evasion.<br>
<form action="deadend.html" method="post" name="form">
Put some text here. <input type="text" name="aname"><p></p>
<input type="button" value="Popup" onClick="NewPopUp('popup2.html');"><p></p>
<input type="submit" value="Submit">
</form>
</body>
</html>
<html>
<head>
<title>Pop up window</title>
</head>
<body>
This is the popup window.<p></p>
<form name="form">
<input type="text" name="status">
<input type="text" name="text2">
</form>
</body>
</html>
I have read several articles on the web that claim they have done this, and most of them work on IE, but all of them fail on Netscape.
The way I have gone about this is using the onFocus in the body tag of the parent window to check if the child popup is on top.
This method keeps the child popup on top in both Netscape and IE, but produces a rather odd effect in Netscape. After the focus is called upon the child popup, text fields in forms on the pop are inaccessable by mouse click (though I can still tab through the fields). I checked the textfield.disabled value and saw that it was set properly, even though I could not type in.
The following 2 pages are my test samples.
<html>
<head>
<title>This is the main window</title>
<script language="JavaScript">
PopUp = null;
function NewPopUp(location)
{
PopUp = window.open(location,'new_window','height=200,width=200');
}
function CheckForOpenWindow()
{
if (PopUp!=null)
{
this.blur();
PopUp.focus();
PopUp.document.form.status.disabled=false;
PopUp.document.form.status.value=PopUp.document.form.status.readOnly;
//PopUp.alert('Please close the popup window you were working on.');
}
}
</script>
</head>
<body onFocus="CheckForOpenWindow();">
This form is for testing with popup window evasion.<br>
<form action="deadend.html" method="post" name="form">
Put some text here. <input type="text" name="aname"><p></p>
<input type="button" value="Popup" onClick="NewPopUp('popup2.html');"><p></p>
<input type="submit" value="Submit">
</form>
</body>
</html>
<html>
<head>
<title>Pop up window</title>
</head>
<body>
This is the popup window.<p></p>
<form name="form">
<input type="text" name="status">
<input type="text" name="text2">
</form>
</body>
</html>