日期:2014-05-16  浏览次数:20383 次

有没有办法捕获到form1.submit()事件
onsubmit事件里捕获不到   form1.submit()

------解决方案--------------------
<script>
function postFun(){
if(){
return true;
}else{
return false
}
}
</script>
<form name= "form1 " onsubmit= "return postFun() ">
------解决方案--------------------

function submit(){
//你要写的提交触发事件
return false;
}
document.all.form1.submit=submit;
类似于写一个js报错的页面 report_error(msg,url,line){}; self.onerror=report_error;

------解决方案--------------------
<script type= "text/javascript ">
// <![CDATA[
function test(oFm){
try{oFm.onsubmit()}catch(e){}
alert( 'addition ');
}
//]]>
</script>
<form id= 't ' onsubmit= "alert( 'ok ') " ">
<button onclick= "test(document.getElementById( 't ')); "> go... </button>
</form>