JavaScript: The Definitive Guide, Sixth Editio javaScript权威指南(第6版) pdf 文字版-文字版, javascript电子书, 和javascript 有关的电子书:

15.9.4 Push Buttons

An important thing to know about event handlers is that within the code of an event handler, the thiskeyword refers to the document element that triggered the event (we’ll talk about this again in Chapter 17 ). Since elements within aelement have a form property that refers to the containing form, the event handlers of these elements can always refer to the Form object as this.form. Going a step further, this means that an event handler for one form element can refer to a sibling form element named x as this.form.x.


15.9.4 Push Buttons

Buttons are one the most commonly used form elements because they provide a clear visual way to allow the user to trigger some scripted action. A button element has no default behavior of its own, and it is never useful unless it has an onclickevent handler. Buttons defined aselements display the plain text of the value attribute. Buttons defined aselements display whatever the element content.

Note that hyperlinks provide the same onclick event handler that buttons do. Use a link when the action to be triggered by the onclick handler can be conceptualized as “following a link”; otherwise, use a button.

15.9 HTML Forms | 401

Submit and reset elements are just like button elements, but they have default actions (submitting and resetting a form) associated with them. If the onclick event handler returns false, the default action of these buttons is not performed. You can use the onclickhandler of a submit element to perform form validation, but it is more common to do this with the onsubmit handler of the Form object itself.

欢迎转载,转载请注明来自一手册:http://yishouce.com/book/1/29904.html
友情链接It题库(ittiku.com)| 版权归yishouce.com所有| 友链等可联系 admin#yishouce.com|粤ICP备16001685号-1