Forum Moderators: open
So,I am calling 'document.form.submit();' on BODY onUnLoad event. It's working fine with NN(4.7,6.0,6.2) and the form is submited successfuly. But it's not working with the IE as per my expectaion.
This is the kind of code i am using inside my HTML page.
<body onUnLoad="document.form.submit();">
<form>
~~~~~~~
~~~~~~~
</form>
</body>
can you Guys let me know what is the reason behind the failure of this Script in IE.
Firstly the syntax looks a little out ... to submit a form the JS syntax is as follows:
document.myFormName.submit();
where,
<form name="myFormName". I think thats part of your problem but I also remember reading that certain browsers only allow the calling of the submit() method through a limited number of events like onclick, onchange and so on. It's possible - though I can't remember the exact rules or browsers - that this could also cause you problems.
Anyone offer any clarity on this?
More importantly you should be aware that the onunload event will fire WHENEVER the page is unloaded, not just when they refresh. So if the user types a new URL in the address bar, clicks on a link in your page or closes the browser window the onunload event will fire. Unfortunately there is no way to catch the 'on refresh' event.