O'Reilly logo

Essential JavaScript™ for Web Professionals, Second Edition by Dan Barrett

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

Project I: Image Rollover Script

Creating and Inserting the Image Objects

Before we get to the creation of the image objects themselves, we must decide where to put our script. Because the rollovers will be on every page of the site, it makes sense to place our script into an external JavaScript file. That way, we only need to place it in a single location instead of on each page. We have already created an external JavaScript file called jsFunctions.js for one of our previous projects, so we can simply add our new script to that file. The home page already has the call to the external file, so we can just copy that <script> tag to all of the other pages on the site.

The first step in our script is to cloak for older browsers that don't support ...

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