tailieunhanh - JavaScript Bible, Gold Edition part 162
JavaScript Bible, Gold Edition part 162. 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. | 1458 Part VI Appendixes INPUT TYPE text NAME convertor VALUE sample onChange upperMe this FORM BODY HTML For Listing 9-2 the button invokes a function that communicates with a different element in the form. Pass the form object. HTML HEAD TITLE Checkbox Inspector TITLE SCRIPT LANGUAGE JavaScript function inspectBox form if alert The 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 For Listing 9-3 again the button invokes a function that looks at other elements in the form. Pass the form object. HTML HEAD TITLE Extracting Highlighted Radio Button TITLE SCRIPT LANGUAGE JavaScript function fullName form for var i 0 i i if i .checked break alert You chose i .value . SCRIPT HEAD BODY FORM B Select your favorite Stooge B INPUT TYPE radio NAME stooges VALUE Moe Howard CHECKED Moe Appendix C Answers to Tutorial Exercises 1459 INPUT TYPE radio NAME stooges VALUE Larry Fine Larry INPUT TYPE radio NAME stooges VALUE Curly Howard Curly BR INPUT TYPE button NAME Viewer VALUE View Full Name. onClick fullName FORM BODY HTML For Listing 9-4 all action is triggered by and confined to the SELECT object. Pass only that object to the function. HTML HEAD TITLE Select Navigation TITLE SCRIPT LANGUAGE JavaScript function goThere list location .value SCRIPT HEAD BODY FORM Choose a place to go SELECT NAME urlList onChange goThere this OPTION SELECTED VALUE Home Page OPTION VALUE Shop Our Store OPTION VALUE Shipping Policies OPTION VALUE http Search the Web SELECT FORM BODY HTML 2. This requires a bit of surgery. The Submit button is replaced with a standard button whose VALUE attribute is set to Submit. The button s onClick event handler calls the checkForm function .
đang nạp các trang xem trước