TAILIEUCHUNG - JavaScript Bible, Gold Edition part 16

JavaScript Bible, Gold Edition part 16. This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include programming fundamentals, JavaScript language elements and how to use them effectively, and how to easily and efficiently add powerful new functionality to HTML documents and Java applets. | CD-80 Part II JavaScript Tutorial Listing 9-2 The Checkbox Object s checked Property HTML HEAD TITLE Checkbox Inspector TITLE SCRIPT LANGUAGE JavaScript function inspectBox if 0 . alertCThe box is checked. else alertCThe box is not checked at the moment. SCRIPT HEAD BODY FORM INPUT TYPE checkbox NAME checkThis Check here BR INPUT TYPE button VALUE Inspect Box onClick inspectBox FORM BODY HTML Checkboxes are generally used as preferences setters rather than as action inducers. While a checkbox object has an onClick event handler a click of a checkbox should never do anything drastic such as navigate to another page. The Radio Object Setting up a group of radio objects for scripting requires a bit more work. To let the browser manage the highlighting and unhighlighting of a related group of buttons you must assign the same name to each of the buttons in the group. You can have multiple groups within a form but each member of the same group must have the same name. Assigning the same name to a form element forces the browser to manage the elements differently than if they each had a unique name. Instead the browser maintains an array list of objects with the same name. The name assigned to the group becomes the name of the array. Some properties apply to the group as a whole other properties apply to individual buttons within the group and must be addressed via array index references. For example you can find out how many buttons are in a group by reading the length property of the group 0 . If you want to find out if a particular button is currently highlighted via the same checked property used for the checkbox you must access the button element individually 0 .groupName 0 .checked Chapter 9 Forms and Form Elements CD-81 Listing 9-3 demonstrates several aspects of the radio button object including how to look through a group of buttons to find out which one is checked and how to use the .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.