Chapter 14. JavaScript and DHTML: Adding Interactivity

JavaScript is a simplified programming language designed for beefing up HTML pages with interactive features. JavaScript aims to give you just enough programming muscle to add some fancy effects, but not enough to cause any serious damage if your code goes wonky. JavaScript is perfect for creating pop-up windows, marquee-style scrolling text, and buttons that light up when a visitor moves his or her mouse pointer over them. On the other hand, JavaScript can’t help you build a hot e-commerce storefront (for that, you need the PayPal tools described in Chapter 13).

The goal of this chapter isn’t to teach you all the details of JavaScript. Instead, by the time this chapter’s through, you should know enough to find a great script online, understand it well enough to make basic changes, and paste it into your pages to get the results you want. Since the Web’s got dozens of JavaScript sites, offering thousands of ready-made scripts for free, these basic skills can come in very handy.

Understanding JavaScript

The JavaScript language has a long history—it first hit the scene with the Netscape Navigator 2 browser in 1995, and Internet Explorer jumped on the bandwagon by adding JavaScript compatibility to IE version 3. Today, all modern browsers support JavaScript, and it’s become wildly popular as a result. However, some justifiably paranoid surfers turn off the JavaScript switch in their browser settings (since malicious developers have, ...

Get Creating Web Sites: The Missing Manual 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.