陪伴而非守候
javascript中的submit与onsubmit事件:submit与onsubmit发生顺序:onsubmit -> submit1.阻止表单提单:<script>function submitFun(){//逻辑判断return true; //允许表单提交//逻辑判断return false;//不允许表单提交}</script><form onsubmit=” reture submitFun();”> //注意此处不能写成 onsubmit=”submitFun();” 否则将表单总是提交的</form>2.onsubmit()与submit() :<script>function fun(){alert("form_submit");}</script><form onsubmit="fun()"><input type="submit" id="aaa" value="submit"> <!--能弹出form_submit--><input type="button" id="bbb" value="onclick_submit" onclick="document.forms[0].submit()"><!--表单会提交,但是不会执行fun() 原因是 onsubmit事件不能通过此种方式触发(在IE环境)直接用脚本documetn.formName.submit()提交表单是不会触发表单的onsubmit()事件的--><input type="button" id="bb1" value="onclick_onsubmit" onclick="document.forms[0].onsubmit()"><!--会触发fun()函数--></form>