Chapter 14. JavaScript: Adding Interactivity

JavaScript is a simplified programming language designed to beef up XHTML pages with interactive features. It gives you just enough programming muscle to add some fancy effects, but not enough to cause 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 visitors mouse 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, it’s to give you enough background so you can find great JavaScript code online, understand it well enough to make basic changes, and then paste it into your pages to get the results you want. Since the Web has 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 Web visitors turn off JavaScript compatibility because malicious developers have, on occasion, used JavaScript-fueled agents to attack computers with pop-up ads and ...

Get Creating a Web Site: The Missing Manual, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.