教程·Javascript 中文手册
Executes JavaScript code when a submit event occurs; that is, when a user submits a form.
| 事件适用对象 | Navigator 2.0 |
onSubmit="handlerText"
| handlerText | JavaScript 代码或对一个 JavaScript 函数的调用。 |
Navigator 4.0: Submitting a form to a mailto: or news: URL requires the UniversalSendMail privilege. 要获取 Navigator 4.0 中关于安全性更多的信息,请看第七章“JavaScript 安全性”
。
You can use onSubmit to prevent a form from being submitted; to do so, put a return statement that returns false in the event handler. Any other returned value lets the form submit. If you omit the return statement, the form is submitted.
| type | 标明了事件的类型。 |
| target | 标明了事件原来发送的对象。 |
In the following example, onSubmit calls the validate function to evaluate the data being submitted. If the data is valid, the form is submitted; otherwise, the form is not submitted.
<FORM onSubmit="return validate(this)">
...
</FORM>See also the示例 forForm
参看
Form.submit
要获得关于事件句柄的常规信息,请看“事件的常规信息”。
要获得关于事件对象的信息,请看事件。