rivkamak
asked on
onclick cancel another function
I have a function that runs onunload.
Is there a way that when someone clicks a different button on the page, and it runs a different function, is there a way to cancel and make sure the onunload won't run?
Is there a way that when someone clicks a different button on the page, and it runs a different function, is there a way to cancel and make sure the onunload won't run?
Try adding
window.onunload=null;
somewhere in your function to cancel the onunload call.
<input type="button" onclik="a_different_function()" value="no unload" />
leakim971,
I think rivkamak is looking for a way to cancel the onunload call. There seems to already be a function called when a button is clicked.
In your example (onclik should be onclick, I think), in a_different_function() adding the line I posted above would cancel the onunload function.
I think rivkamak is looking for a way to cancel the onunload call. There seems to already be a function called when a button is clicked.
In your example (onclik should be onclick, I think), in a_different_function() adding the line I posted above would cancel the onunload function.
ASKER
My onlick submits the page. But I don't want the onunload to happen when you click the submit button.
If the form submits but I put value="no unload", then the unload wont' happen?
If the form submits but I put value="no unload", then the unload wont' happen?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
use a input with type = button
and not a submit button
set the onclick attribute of this button to run the different function