<img src="submit.gif" border="0" onClick="document.form1.submit()" >这种的话要这样写:<img src="submit.gif" border="0" onClick="checkapply()" > function checkapply(){
这里是表单检证if(表单检证 ==true ){
document.form1.submit()
}
}
这里是表单检证if(表单检证 ==true ){
document.form1.submit()
}
}
----
是你理解错了。
formObj.submit()里不会再执行onsubmit
onSubmit="return checkapply()" 可以不要了其实就是点击图片之后调用javascript验证函数,如果不通过则弹出消息框,通过则调用document.form1.submit(),所以onSubmit="return checkapply()" 可以不要了.但为什么这种写法要改这么多?
重点理解红色的两句:
-----onsubmit Event Internet Development Index --------------------------------------------------------------------------------Fires when a FORM is about to be submitted. SyntaxInline HTML <FORM onsubmit = "handler" ... > All platforms
Event property FORM.onsubmit = handler JScript only
FORM.onsubmit = GetRef("handler") Visual Basic Scripting Edition (VBScript) 5.0 or later only
Named script <SCRIPT FOR = FORM EVENT = onsubmit> Internet Explorer only Event InformationBubbles No
Cancels Yes
To invoke Submit a form using the INPUT TYPE=submit, INPUT TYPE=image, or BUTTON TYPE=submit object.
Default action Causes a form to be sent to whatever location is stipulated in the ACTION attribute of the form object.
ResYou can override this event by returning false in the event handler. Use this capability to validate data on the client side to prevent invalid data from being submitted to the server. If the event handler is called by the onsubmit attribute of the form object, the code must explicitly request the return value using the return function, and the event handler must provide an explicit return value for each possible code path in the event handler function.The submit method does not invoke the onsubmit event handler.