I'm working with ASP.NET 1.1 and I am attempting to compare the value of a textbox on the pages onunload event. The screen that is open is a pop-up screen that can be opened from links on two different pages. What i want to do is cause a post back to the form from which the pop-up screen originated.
Here is my code:
- <script language="javascript" type=text/javascript>
-
//If the window is closed
-
function doUnload(){
-
if (window.event.clientX < 0 && window.event.clientY < 0)
-
{
-
var Division = '' + document.forms(0).txtDivisionCode.value + '';
-
if (document.forms(0).txtScreen.value = 'Division'){
-
window.opener.location = '../Maintenance/Divisions.aspx';
-
}
-
else {
-
UpdateAcctEditScreen(Division);
-
}
-
}
-
}
-
</script>
-
...
-
<body onunload="doUnload()">
The window.opener.location routine works fine in that it sucessfully loads the Divisions form. However, it does this no matter what the value of the txtScreen textbox is. It seems the Javascript is not performing the if statement correctly. Any help is appreciated. Thanks.