Tham khảo sách 'javascript bible_ chapter 23', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Button Objects This chapter is devoted to those lovable buttons that invite users to initiate action and make choices with a single click of the mouse button. In this category fall the standard system-looking buttons with labels on them as well as radio buttons and checkboxes. For such workhorses of the HTML form these objects have a limited vocabulary of properties methods and event handlers. I group together the button submit and reset objects for an important reason they look alike yet they are intended for very different purposes. It is important to know when to use which button especially in the case of the button and submit objects. Many a newcomer get the two confused and wind up with scripting error headaches. That shouldn t happen to you by the time you ve finished this chapter. The Button Object Submit Object and Reset Object In This Chapter Triggering action from a user s click of a button Assigning hidden values to radio and checkbox buttons Distinguishing between radio button families and their individual buttons Properties Methods Event Handlers name click onClick type handleEvent onMouseDown value onMouseUp Syntax Creating a button FORM INPUT TYPE button submit reset NAME buttonName VALUE labelText onClick handlerTextOrFunction onMouseDown handlerTextOrFunction onMouseUp handlerTextOrFunction FORM 458 Part III JavaScript Object and Language Reference Accessing button object properties or methods window. method parameters window. index .property method parameters window. index . method parameters window. index .elements index .property method parameters About these objects Button objects generate standard pushbutton-style user interface elements on the page depending on the operating system on which the particular browser runs. Figure 23-1 shows examples of a typical button in both the Windows 95 and Macintosh versions for Navigator 4. The