tailieunhanh - JavaScript Bible, Gold Edition part 120
JavaScript Bible, Gold Edition part 120. 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. | 1038 Part IV JavaScript Core Language Reference Listing 39-1 continued alert Thanks for the B. else if inpVal C No. Is it a C alert Thanks for the C. else Nope. None of the above alert Sorry wrong letter or case. else value was empty so skipped all other stuff above alert You did not enter anything. SCRIPT HEAD BODY FORM Please enter A B or C INPUT TYPE text NAME entry onChange testLetter FORM BODY HTML Each condition executes only the statements that apply to that particular condition even if it takes several queries to find out what the entry is. You do not need to break out of the nested construction because when a true response is found the relevant statement executes and no other statements occur in the execution path to run. Even if you understand how to construct a hair-raising nested construction such as the one in Listing 39-1 the trickiest part is making sure that each left brace has a corresponding right brace. My technique for ensuring this pairing is to enter the right brace immediately after I type the left brace. I typically type the left brace press Enter twice once to open a free line for the next statement once for the line that is to receive the right brace tab if necessary to the same indentation as the line containing the left brace and then type the right brace. Later if I have to insert something indented I just push down the right braces that I entered earlier. If I keep up this methodology throughout the process the right braces appear at the desired indentation after I m finished even if the braces end up being dozens of lines below their original spot. Conditional Expressions NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility While I m showing you decision-making constructions in JavaScript now is a good time to introduce a special type of expression that you can use in place of an Chapter 39 Control Structures and Exception Handling 1039 if. . .else control structure for a common type of decision the instance .
đang nạp các trang xem trước