Actaully my application contains hundreds of pages. Now I need to attach the "disablePage" event to the onSubmit form. I do not want to go to every page and write:
<form name="frmname" onSubmit="disablePage();">
What am I doing now: -
excerpt from the common.js file; [included on all pages]
if (window.addEventListener){
window.addEventListener('load', attachFormSubmit, false);
} else if (window.attachEvent){
window.attachEvent('onload', attachFormSubmit );
}
function attachFormSubmit(){
forms = document.getElementsByTagName('Form');
if ( forms[0] ){
if (forms[0].addEventListener){
forms[0].addEventListener('submit', disablePage, false);
} else if (forms[0].attachEvent){
forms[0].attachEvent('onsubmit', disablePage);
}
}
}
function disablePage(){
document.getElementById("pageHideDivID").style.display='inline';
}
Up to this point, everything is in order, disablePage () is bound to the forms of the entire page.
But the problem is that if someone has already bound a method to onSubmit or onLoad, this should also be done. And I think, according to my code, the code will never be executed. What should I do to link their method?
No JQuery please