Javascript onsubmit()的格式是什么?
有人能给我解释一下这个函数吗。你在做什么!表单.onsubmit()和Javascript onsubmit()的格式是什么?,javascript,javascript-events,Javascript,Javascript Events,有人能给我解释一下这个函数吗。你在做什么!表单.onsubmit()和表单.onsubmit()!=假是什么意思 //<![CDATA[ var theForm = document.forms['Form']; if (!theForm) { theForm = document.Form; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.ons
表单.onsubmit()!=假
是什么意思
//<![CDATA[
var theForm = document.forms['Form'];
if (!theForm) {
theForm = document.Form;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
表单的含义是什么。在submit
中,它怎么可能是null
和!null
是否为真
当我检查表单.onsubmit()时false我得到:
theForm.onsubmit()
TypeError: object is not a function
theForm.onsubmit() != false
TypeError: object is not a function
表单onsubmit
和表单onsubmit()
之间的区别是什么?表单onsubmit是提交
事件的事件处理程序。如果为null
,则未设置任何处理程序。设置时,它应该是一个函数form.onsubmit()
调用该函数,就像其他函数一样
您在表单.onsubmit()中遇到了这个错误,因为显然没有设置任何处理程序。您需要一起执行整个表达式
如果没有处理程序,或者调用处理程序返回false,则执行代码块
theForm.onsubmit()
TypeError: object is not a function
theForm.onsubmit() != false
TypeError: object is not a function
if (!theForm.onsubmit || (theForm.onsubmit() != false))