javascript - What is theForm.onsubmit()? -
javascript - What is theForm.onsubmit()? -
can explain function me. !theform.onsubmit()
, theform.onsubmit() != false
mean?
//<![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(); } } //]]>
and when checked console got this;
!theform.onsubmit true theform.onsubmit null !null true
what meaning of theform.onsubmit
, how can null
, !null
true?
and when checked theform.onsubmit() != false
got:
theform.onsubmit() typeerror: object not function theform.onsubmit() != false typeerror: object not function
what difference way between theform.onsubmit
, theform.onsubmit()
?
theform.onsubmit
event handler submit
event. if null
, no handler has been set. when set, should function. theform.onsubmit()
calls function, other.
you getting error theform.onsubmit()
because apparently, no handler has been set. need execute entire look together.
if (!theform.onsubmit || (theform.onsubmit() != false))
if there no handler, or calling handler returns false, execute code block.
javascript javascript-events
Comments
Post a Comment