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

can i disable control panel's close button?????

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
hello there,

i want to execute a javascript function, when user closes the child window. for that, i've given a button in my code. when user clicks on it, i am calling a function which executes the code and then closes the window with self.close() method.
now, if user closes the window using the control panel's close button, then how can i restrict him?

can i disable control panel's close button?

i've tried to use Body Unload() event, but it doesn't serve my purpose. as, it will be fired every time the form in the window is submitted. Is there any event handler which can handle the window close event such as window close()?

any help would be appreciated.

thanks,
paras
 
Seems to me that if you override the 'Action' tag of your form by using a non-Submit button with a custom script ending with form.submit(), then you could set a flag somewhere in there that your Body Unload() event could check for ... e.g.

<html>
<head>
<script language=&quot;JavaScript&quot;>
<!--
isSubmit = 0;

function MySubmit() { //v3.0
isSubmit = 1;
.
.
.
document.forms[0].submit();
}

function Body_Unload() { //v3.0
// only perform this function if isSubmit hasn't been set
if (isSubmit == 0) {...}
}

//-->
</script>
</head>
<body onUnLoad=&quot;Body_Unload()&quot;>
<form METHOD=POST ACTION=&quot;some.cgi&quot;>
<input type=&quot;button&quot; name=&quot;Button&quot; value=&quot;Button&quot; onClick=&quot;MySubmit()&quot;>
</form>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top