O'Reilly logo

Creating Web Sites Bible, Third Edition by David A. Crowder, Phillip Crowder

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

Chapter 13. Making Dynamic Pages with JavaScript

IN THIS CHAPTER

  • Trying out JavaScript

  • Understanding JavaScript

  • Using events to trigger scripts

  • Seeing elements as objects

  • Form Validation

  • Examining browser compatibility

  • JavaScript quick reference

Many people confuse JavaScript with Java. It's understandable, given the similarity in their names. But the two are not the same. Although some of JavaScript is somewhat similar to Java, Java is closer to C++ — all programming languages bear some degree of resemblance to one another. Java is a major language that is used for developing standalone programs, many of which are huge and extremely complex. JavaScript, on the other hand, is used to write short and simple programs that can run in Web browsers.

JavaScript's name came from Netscape licensing the Java name from Sun in order to capitalize on the Java craze at the time. JavaScript was originally called LiveScript.

Of course, you can use Java to write short and simple programs; many of the Java applets available to use on Web pages certainly fit this description. And you can also use JavaScript to create some incredibly intricate interactive programs on your Web pages. As with anything else on the Web, the limits are mainly up to you.

Trying Out JavaScript

Before we get into any of the details of how JavaScript works, let's see just how simple it can be. Type the following code into your HTML editor:

<HTML>
     <HEAD>
     <TITLE>JavaScript Is Great</TITLE>
     </HEAD>
<BODY onLoad="alert('Welcome to the war, ...

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