Programming in JavaScript
In this chapter, we'll build our JavaScript foundation by getting the syntax of the language down. For example, you can make decisions based on your data values with the JavaScript if statement. In this code, I'm comparing the value 143 to 719, and if 719 is greater than 143, displaying the message The first value is greater than the second.
<HTML> <HEAD> <TITLE> Using the JavaScript if Statement </TITLE> </HEAD> <BODY> <SCRIPT LANGUAGE="JavaScript"> if(719 > 143){ document.writeln( "The first value is greater than the second." ) } </SCRIPT> <CENTER> <H1> Using the JavaScript if Statement </H1> </CENTER> </BODY> </HTML>
You can see this Web page at work in Figure 6.3—as indicated in that page, 719 is indeed greater ...
Get Inside XML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.