tailieunhanh - JavaScript Bible, Gold Edition part 124

JavaScript Bible, Gold Edition part 124. 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. | 1078 Part IV JavaScript Core Language Reference add-by-value operator to tack additional string values onto whatever is in the elem variable at the time. Without the add-by-value operator you are forced to use the plain equals assignment operator for each line of code to concatenate new string data to the existing string data. In that case the first few lines of code look as shown var elem start assembling next part of page and form elem elem P Select a regional office elem elem SELECT NAME offices onChange getData Within the for loop the repetition of elem makes the code very difficult to read trace and maintain. These enhanced assignment operators are excellent shortcuts that you should use at every turn. Boolean Operators NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility Because a great deal of programming involves logic it is no accident that the arithmetic of the logic world plays an important role. You ve already seen dozens of instances where programs make all kinds of decisions based on whether a statement or expression is the Boolean value true or false. What you haven t seen much of yet is how to combine multiple Boolean values and expressions a quality that scripts with slightly above average complexity may need to have in them. In the various condition expressions required throughout JavaScript such as in an if construction the condition that the program must test for may be more complicated than say whether a variable value is greater than a certain fixed value or whether a field is not empty. Look at the case of validating a text field entry for whether the entry contains all the numbers that your script may want. Without some magical JavaScript function to tell you whether or not a string consists of all numbers you have to break apart the entry character by character and examine whether each character falls within the range of 0 through 9. But that examination actually comprises two tests You can test for any character whose ASCII

TỪ KHÓA LIÊN QUAN