Uh-oh, it looks like your Internet Explorer is out of date.

For a better shopping experience, please upgrade now.

JavaScript for the World Wide Web: Visual QuickStart Guide, Fifth Edition

JavaScript for the World Wide Web: Visual QuickStart Guide, Fifth Edition

by Tom Negrino, Dori Smith

The Web doesn¿t stand still¿not even for a minute¿and neither do the languages that Web pages are based on. That¿s why you need this eagerly anticipated update to the popular JavaScript for the World Wide Web: Visual QuickStart Guide. Through a combination of task-based instruction and strong visuals, best-selling authors and


The Web doesn¿t stand still¿not even for a minute¿and neither do the languages that Web pages are based on. That¿s why you need this eagerly anticipated update to the popular JavaScript for the World Wide Web: Visual QuickStart Guide. Through a combination of task-based instruction and strong visuals, best-selling authors and Web gurus Tom Negrino and Dori Smith take you step by step through all of today¿s JavaScript essentials: creating navigation bars and other user interface elements, producing dynamic images and smart forms, controlling and detecting browsers, creating and manipulating windows, validating user entries in Web forms, and more. Whether you¿re a beginning scripter who wants a thorough introduction to the topic or a more advanced scripter who needs a convenient reference, you¿ll find what you need here¿in straightforward language peppered with tips and techniques drawn from the authors¿ years of experience. By the end of the volume, you¿ll be able to smoothly integrate HTML, JavaScript, and CSS to bring your Web sites to life.

Editorial Reviews

The Barnes & Noble Review
Web scripting is about getting the job done quickly and well. You don’t want more technical overhead than necessary. You want “news you can use” -- presented cleanly and simply, so it’s easy to use.

If you need to learn JavaScript, here’s a book that reflects the practical spirit of web scripting: JavaScript for the World Wide Web: Visual QuickStart Guide, Fifth Edition.

Updated for the latest browsers, this book takes you through all the fundamentals, from variables and events through DHTML and debugging. You’ll start with a quick overview and a little history: what JavaScript is (and isn’t); what it can (and can’t) do; where to place your scripts; how to hide scripts from ancient, stupid browsers; and how to intelligently comment them so you’ll remember what on Earth you were thinking.

Next, it’s on to basic meat-and-potatoes interactivity: alerting, prompting, and redirecting users; confirming their choices; and detecting browsers and plug-ins. You’ll then move on to what may be the world’s No. 1 use for JavaScript: rollovers.

Authors Tom Negrino and Dori Smith show how to create more effective rollovers; insert and manage multiple rollovers on the same page; trigger rollovers from links; change several links from a single rollover; and use functions to streamline your rollover code.

Building on what you’ve learned, you’ll learn how to create “cycling” ad banners, image maps, and slide shows. Want to open multiple windows? Change the contents of a window? Update one window from another? Precisely position windows on the screen? It’s all here.

The authors cover just about everything you might want to do with forms, from authentication to “select-and-go” navigation, menu selections to email address validation. There’s even a chapter on regular expressions, which let you manipulate whatever text users throw at you.

Want to add dynamic features to your page? Here’s how, starting with simple stuff (displaying the current date) and moving on to slicker techniques (working with referrer pages, writing text into documents “on the fly.”) There’s a full chapter on JavaScript event handling and another on placing, reading, and using cookies.

You’ll learn the basics of driving CSS and DHTML with JavaScript -- including detailed coverage of differences between IE Mac and Windows, Netscape 4.x and 6. Since Negrino and Smith are active members of the Web Standards Project Steering Committee, they’re well placed to advise on those maddening cross-platform/browser issues.

Next, they introduce several advanced user interface techniques (pull-down and sliding menus, tool tips, and click-anywhere form fields); then show how to minimize the amount of code you have to write and manage. Neat feature: a full chapter on “bookmarklets,” those surprisingly useful one-line scripts that nestle in your URL line and control your browser without even using web pages.

Increasingly, folks write JavaScript within their web designware. This edition adds a full chapter on using Dreamweaver, FrontPage, Fireworks, and GoLive as JavaScript editors. There’s practical debugging coverage, plus concise references to JavaScript, its objects, and the basics of CSS.

Clear writing, lean code, easy access, task-based focus: can’t beat it. Bill Camarda

Bill Camarda is a consultant, writer, and web/multimedia content developer. His 15 books include Special Edition Using Word 2000 and Upgrading & Fixing Networks for Dummies, Second Edition.

Library Journal
JavaScript's popularity shows no signs of waning, so libraries could benefit from up-to-date titles. A clear and cohesive guide recommended for beginners and all libraries, Visual QuickStart updates older editions with coverage of v.1.5, showing how to complete common tasks step by step, with typical and plentiful tips, screen shots, and tables. A companion web site (www.javascriptworld.com) at the time of this review included only scripts from the fourth edition but should soon be updated to include current cut-and-paste scripts and files. Appendixes address JavaScript "genealogy and reference," reserved words, CSS, and additional resources. Everything, also appropriate for beginners and all libraries, covers similar ground but with more background and fewer figures. Notes, cautions, sidebars, tables, and figures break up the text; appendixes provide quick references for HTML tags and JavaScript statements, classes, and objects. For intermediate to advanced users, Cookbook jumps right into coding examples. Each "recipe" contains a problem, solution, discussion, and useful See Also references; the book's coverage of common "how-to" questions ranges from concatenating strings to embedding XML data in web pages. Cookbook's discussion of both JavaScript and DHTML and clear explanations of common coding issues make it a fantastic reference for larger libraries. Copyright 2003 Reed Business Information.
Discusses integration of the JavaScript programming language to add interactivity to web pages with scripts for such tasks as navigation, form validation, cookie management, frame creation, and event handling. The fourth edition expands explanations of HTML in the sidebars. Annotation c. Book News, Inc., Portland, OR (booknews.com)

Product Details

Peachpit Press
Publication date:
Visual QuickStart Guide Series
Edition description:
Product dimensions:
6.96(w) x 9.22(h) x 1.07(d)

Read an Excerpt

Chapter 3: Fun with Images

Creating More Effective Rollovers

To make the illusion of animation work, you need to make sure that the replacement image appears immediately, with no delay while it is fetched from the server. To do that, you use JavaScript to preload all the images into the browser¹s cache (so that they are already on the user¹s hard disk when they are needed) and place the images into script variables. Then when the user moves the mouse over an image, the script swaps out one variable containing an image for a second variable containing the replacement image. Script 3.2 shows how it is done. The visible result is the same as in Figures 3.1 and 3.2, but the apparent animation is smoother.

To create a better rollover:

1. if (document.images) {
arrowRed = new Image
arrowBlue = new Image
arrowRed.src = "images/redArrow.gif" arrowBlue.src =

This code checks to see if the browser understands image objects (see sidebar). If the browser does, the code assigns arrowRed and arrowBlue to two separate image objects. Then, using the .src property, it fills the two objects with the GIFs of the red and blue arrows.

2. else {
arrowRed = " "
arrowBlue = " "
document.arrow = " "
This is the code that tells old browsers (ones that failed the test in step 1) what to do. In order to keep from getting error messages in old browsers, we have tocreate some dummy variables-that is, variables that won't do anything but be created and set to empty. Think of them as placeholders. Create two variables named arrowRed and arrowBlue, andset them to empty. Then create and set document.arrow to empty, too.

3. < A HREF=next.html onMouseover='document.arrow.src=arrowRed.src 'onMouseout=document.arrow.src='arrowBlue.src>

The rest of the rollover gets handled in the link tag. When the user puts the mouse over the blue arrow graphic (onMouseover), the script swaps the blue arrow for the graphic with the red arrow (document.arrow.src=arrowRed.src). When the mouse cursor leaves the area of the graphic, the script reverts the graphic back to the blue arrow.


When you prepare your graphics for rollovers, make sure that all your GIF images are not transparent. Transparent images will show the image they are replacing underneath.
Both the original and the replacement images need to have identical dimensions. Otherwise, the browser will resize the images for you and probably won't like the distorted result.

Triggering Rollovers from a Link

In prior examples, the user triggered the rollover by moving the mouse over an image. But you can also make a rollover occur when the user points at a text link, as in Figures 3.3 and 3.4. All you need to do is to puta text link within the <A HREF tag, as inScript 3.3.

To trigger a rollover from a link:u <A HREF=next.html onMouseover='document.arrow.src=arrowRed.src 'onMouseout=document.arrow.src='arrowBlue.src > <H1 >Next page </H1 >' </A > <P > <BR >

Note that the text link that says Next page is within the link tag, which makes it the thing that onMouseover and onMouseout use as a trigger. We've moved the IMG tag out of the link tag; it now follows the link tag.


This trigger technique is useful when you want to provide the user with a preview of what they will see if they click the link at which they are pointing. For example, say you have a travel site describing trips to Scotland, Tahiti, and Cleveland. On the left of the page could be a column of text links for each destination, while on the right could be a preview area where an image appears. As the user points at the name of a destination, a picture of that place appears in the preview area. Clicking on the link takes the user to a page detailing their fabulous vacation spot...

Meet the Author

Veteran journalist and Mac guru Tom Negrino is the author of Macromedia Contribute for Windows: Visual QuickStart Guide and numerous other Visual QuickStart guides, including (with Dori Smith) the last three editions of this volume. Dori Smith is a programmer and journalist who, like Tom, has several Visual QuickStart Guides under her belt, including Java 2 for the World Wide Web: Visual QuickStart Guide. Both authors are on the Steering Committee for the Web Standards Project.

Customer Reviews

Average Review:

Post to your social network


Most Helpful Customer Reviews

See all customer reviews