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

JavaScript for the World Wide Web: Visual QuickStart Guide

3.1 19
by Tom Negrino, Dori Smith

See All Formats & Editions

JavaScript for the World Wide Web, 4th Edition: Visual QuickStart Guide is the perfect book for those who are familiar with HTML and are ready to move up to the next level to add some pizzazz and interactivity to their Web site. Using a task-based, visual step-by-step approach and loads of useful illustrations, readers learn the basics of JavaScript:


JavaScript for the World Wide Web, 4th Edition: Visual QuickStart Guide is the perfect book for those who are familiar with HTML and are ready to move up to the next level to add some pizzazz and interactivity to their Web site. Using a task-based, visual step-by-step approach and loads of useful illustrations, readers learn the basics of JavaScript: creating rollovers and frames, validating forms, working with browser windows, adding dynamic elements to your site, and more.

This revised bestseller has been expanded with five new chapters and a new appendix. New material can be found in the following chapters:

  • Forms and Regular Expressions
  • Handling Events
  • Introducing Cascading Style Sheets
  • Applied JavaScript
  • Bookmarklets
  • and a new appendix: Cascading Style Sheets Reference

An exciting new feature of this book is the 16-page color appendix of the JavaScript Object Flowchart and the JavaScript Object Table, all in glorious four-color detail.

Don't want to wear out your fingers by typing in all that code? Check out the supplemental Web site, where you can find all the scripts ready for you to cut and paste into your own work, as well as additional notes, addenda, and updates.

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.

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:
Older Edition
Product dimensions:
6.98(w) x 9.00(h) x 0.72(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

Tom Negrino writes books and is a contributing editor for Macworld magazine. He's been working with the Macintosh since the innocent, halcyon days of 1984. Shortly thereafter, he began his writing career with MacGuide magazine , joining the Macworld ranks in 1987. His work has also appeared in Digital Video magazine, where he was a contributing editor and monthly columnist.

Tom is a frequent speaker at Macworld Expo, Thunder Lizard's conferences, and other computer trade shows, and is a freelance computer consultant. He has served on the board of the Los Angeles Macintosh Group since 1985, recently ending his tenure as the group's president.

Dori Smith has been programming for over 20 years. As a partner in Chalcedony Consulting, she does programming, training, writing, and Web design. You can find out more about her at her personal site. Dori is also a contributing editor for NetProfessional magazine, is on their advisory board, and is a member of the Web Standards Project Steering Committee.

Customer Reviews

Average Review:

Post to your social network


Most Helpful Customer Reviews

See all customer reviews

JavaScript for the World Wide Web: Visual QuickStart Guide 3.1 out of 5 based on 0 ratings. 19 reviews.
Guest More than 1 year ago
This book is terrible and the back cover lies. This doesn't work like a reference book, it doesn't even provide difintions for basic functions. And it begins by saying that Javascript is nothing like Java which is a complete lie. I bought this book, learned Java, and then came back to JScript. I can do most of these examples more efficiently just based on my Java background. The book is a failure for anyone interested in real web design.
Guest More than 1 year ago
Good introduction of Javascript. Some handy scripts to get started. I recommend this for anyone starting out.
Guest More than 1 year ago
This book is a complete waste of time and money. If you want to use JavaScript, start it right by using other choice of book.
Guest More than 1 year ago
Read the other review, and you'll know what i'm talking about. It doesn't explain anything. I learned html from reading a couple of books, and wanted to improve my abilities. If that is your case go buy a diffrent book! This one is horrible. Some of the code, doesn't even work!
Guest More than 1 year ago
If you don't have time to learn how to add JavaScript to your Web pages, use the book and its companion site where you can download scripts without having to type it all in. The book is set up by the cool stuff you want to add to your Web site to jazz it up. Don't expect explanations of definitions, objects, operators, syntax, and all that stuff that scare the non-programmer. There are other books that serve that purpose. This one is to help you add scripts quickly and painlessly or even tweak them. It takes you step-by-step through each feature along with its code and a screen shot so you know what to do.
Guest More than 1 year ago
Basically, this is a good book to start learning the fundamentals of JavaScript. This is the book I used to learn the basics. Also, because of its small size, its not exactly a book that will intimidate beginners. I borrowed this book from the library, and within like 3 weeks of reading it, trying to write my own code, and experimenting, I managed to do some pretty neat things, so basically i highly recommend this book for beginners who want to learn the foundation of javascript.
Guest More than 1 year ago
This book seems to have been written for those who want to include some JavaScript functionality on their webpages without having to learn the nitty-gritty. The 'programming-lingo' is not explained well for non-programmers, and the explanation of the examples and algorithms are not thorough. It does not enable one to build further then the listed examples. If you want some scipts to copy onto your webpage - great. If you want to learn the language this is not the book for you.
Guest More than 1 year ago
I strongly recommend this book to people who are just starting to learn about JavaScript. The book is quite simple and well organized in an easy to read fashion. The colors add a lot of flavor and the occasional tips are quite useful. I totally disagree with those who have rated this book anything less than 3 stars because it compares quite well to other good books in the market. I also like the way they have left a lot of space in most pages for those who like to write comments for their personal future reference. You can also download all scripts from their web site so no need to type. The only thing I don't like is the focus of the book is mostly on Netscape.
Guest More than 1 year ago
This is by far my favorite book. This book took a 'I know nothing about javascript' to creating customized scripts. If you know absolutely nothing about javascript, this book is for you. Prior knowledge of HTML is needed but after that this book is the one to get. After this book dive in to DHTML for the World Wide Web also by the same publisher.
Guest More than 1 year ago
book worthless. You will learn pretty much nothing about javascript. This book is written so you can use the exact scripts to accomplish small tasks. Better off cutting and pasting somewhere than typing in something that is not well explained anyway. - Not for beginners (you will learn zero), pro's know better. This book sucks.
Guest More than 1 year ago
I really enjoy this book. I am the type of person that likes to figure things out by myself, and not going trough the multiple definitions and explanations. Therefore, I recommend this book only to those who aren't really into reading tons of explanations and definitions, but can understand most things without help.
Guest More than 1 year ago
I was very excited to get this book, but it ends up with returning it. This book has very poor explaintation about how to use methods or each function etc. It just decribes when you should put those commands and where to put it, but it never tells you why, which will make you really frustrated especially if you are a beginner.
Guest More than 1 year ago
This book really opened the door to JavaScript for me. It shows you step by step, in easy to follow samples, how to create a bunch of useful scripts. Everything is done cross browser and cross platform compatible so you don't waste your time writing scripts that don't work. If you are ready to start learning JavaScript then this book is the book to get, I recommend it to everyone starting to learn JavaScript.
Guest More than 1 year ago
In my opinion this is one of the worst books for learning javascript. It doesn't explain what each function does, it just gives you a chart on what the different functions mean. All they give you is example upon example, never really explaining why putting this over here makes this do that. If you just want to copy some scripts and put them on your page, buy this book. I recommend getting scripts off the internet. But if you actually want to learn javascript buy another book. This book is one simple reason that I am turned off about java script. So for the record one more time, don't waste your money on this book, it may say bestseller on it, but it never tells you how many returns or garbage cans this book has had.
Guest More than 1 year ago
This book is virtually useless. It doesn't teach you JavaScript, it jsut gives you many specific examples, but becuase it never gets into the syntax of the language, you can do little more than use thier scripts on your page. If you want to learn JavaScript, this book is not for you, if all you wanna do is a few rollovers, then use Adobe ImageReady. Who is this book for? Not me.
Guest More than 1 year ago
i know HTML and i wanted to learn javascript this is a greaty book for just that.
Guest More than 1 year ago
This books offers reference type access as well as some samples. There are more thorough and extensive books I'm sure but this was perfect for me, my price range, and what I wanted from a programming book.
Guest More than 1 year ago
I purchased this book as the 3rd Edition to the Peachpit Press series on JavaScript. I had purchased the 1st Edition by Ted Gesing and Jeremy Schneider (ISBN: 0-201-68814-X) a couple of years ago and found it very helpful. The 3rd Edition has almost twice as many pages so I assumed it would contain additional information not covered in the 1st edition. I am sorry to report that the 3rd edition has made some serious omissions. For example, the word 'return' allows the programmer to specify whether a form is submitted or not. This can be very important if you catch an error during validation and wish to stop the submit process. The text does not mention it. Another example, parseInt and parseFloat are functions that ensure that a value is interpreted as a number and not text. Again, there is no reference to these important functions. I would urge anyone to seek out the 1st edition referened above as a good reference book instead of the 3rd edition.
Guest More than 1 year ago
This book is a great tutorial on JavaScript if you already know HTML. It is full of easy to follow examples. BUY THIS!!!