berkshirea
Technical User
hi guys, i have a script here that pops-up when a visitor is to browse away from it, which is working ok. but the moment a form is submitted, it still pops-up, which i don't want.
how can i stop this popping up when 'Submit' button is clicked?
thanks for any help.
how can i stop this popping up when 'Submit' button is clicked?
Code:
<body>
<script>
function goodbye(e) {
if(!e) e = window.event;
//e.cancelBubble is supported by IE - this will kill the bubbling process.
e.cancelBubble = true;
e.returnValue = 'Please comment on this draft.'; //This is displayed on the dialog
//e.stopPropagation works in Firefox.
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
}
window.onbeforeunload=goodbye;
</script>
<form id="form1" name="form1" method="post" action="test.aspx">
<label>
<input type="text" name="textfield" />
</label>
<input type="submit" name="Submit" value="Submit" />
</form>
</body>
thanks for any help.