O'Reilly logo

Real World XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with JavaScript Operators

What if you wanted to manipulate your data in JavaScript code? Say, for example, that you needed to multiple 219 by 45—how would you do it? In JavaScript, you can use the multiplication operator (*). Here's an example showing how this works:

Listing . ch06_05.html
 
<HTML>
    <HEAD>
        <TITLE>
            Using Operators In JavaScript
        </TITLE>
    </HEAD>

    <BODY>
        <CENTER>
            <H1>
                Using Operators In JavaScript
            </H1>
        </CENTER>

        <SCRIPT LANGUAGE="JavaScript">
            var result
					result = 219 * 45
					document.writeln("219 * 45 = " +  result)
        </SCRIPT>
    </BODY>
</HTML>

You can see the results of this code in Figure 6-5.

Figure 6-5. Using JavaScript operators in Internet Explorer.

As you might expect, there are many operators available in JavaScript. For ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required