• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL



Welcome to Inside JavaScript. This book is designed to be as comprehensive—and as accessible—as is possible for a single book on JavaScript. You’ll find JavaScript just about everywhere you look on the Internet today, and even in many places behind the scenes. Thus, you’ve come to the right place; I believe this book provides the most complete coverage of what’s going on in JavaScript as compared to any other JavaScript book today.

We’re going to put JavaScript to work in depth, pushing the envelope as far as it can go. The best way to learn any topic such as JavaScript is by example, and this is an example-oriented book. You’ll find hundreds of tested examples here, ready to be used.

Writing JavaScript is not some ordinary and monotonous task: It inspires artistry, devotion, passion, exaltation, and eccentricity—not to mention exasperation and frustration. I’ll try to be true to that spirit and capture as much of the excitement and power of JavaScript in this book as I can.

Who Should Read This Book

Anyone who wants to learn as much as there is to learn about JavaScript should read this book. We’re going to start with the basics. I do assume that you have some knowledge of HTML, but not necessarily very much. We’ll see how to create JavaScript scripts from scratch in this book, starting at the very beginning.


Inside JavaScript is designed to give you as much of the whole JavaScript story as one book can hold. We’ll not only see the full JavaScript syntax—from the most basic to the most advanced—but also dig into many of the ways in which JavaScript is used.

Unlike other JavaScript books, I’m also going to list which browser and which browser version supports every feature we’re going to use. That information will enable you to develop JavaScript applications across multiple browsers with relative ease.

Here’s a sample of some of the topics in this book—note that each of these topics themselves has many subtopics (too many to list here):

  • The full JavaScript syntax

  • Cross-browser issues: Which browser are you using?

  • Dynamic HTML

  • Handling errors

  • Redirecting browsers

  • Accessing HTML elements

  • Accessing the status bar

  • Creating dialog boxes

  • Using the clipboard

  • Alerts, confirmations, and prompts

  • Creating popups

  • Moving windows

  • Opening and closing new windows

  • Printing

  • Scrolling a window

  • Creating timed events

  • Setting colors

  • Creating cookies

  • Handling file dates and sizes

  • Tracking user navigation

  • Creating new elements and nodes

  • Finding elements by location

  • Navigating to a new URL

  • Using the go, forward, and back methods

  • Finding and replacing text

  • Selecting text

  • Using forms

  • Submitting forms

  • Emailing forms

  • Clicking a button from code

  • Check boxes and radio buttons

  • Working with HTML text and select controls

  • Creating new options in a select control

  • The file upload element

  • Working with hyperlinks, lists, and tables

  • Using JavaScript URLs

  • Working with the mouse, keyboard, and images

  • Mouse rollovers

  • Precaching images and the image object

  • Image maps

  • Handling events

  • Changing web pages on-the-fly

  • Changing visual properties on-the-fly

  • Rewriting documents with the document.write method

  • Setting element visibility on-the-fly

  • Adding visual effects with filters

  • Using Internet Explorer visual transitions

  • Changing pages with dynamic styles

  • Drawing graphics with Vector Markup Language

  • Using Internet Explorer Direct Animation

  • Netscape Navigator layers

  • Internet Explorer filters

  • Internet Explorer visual transitions

  • Dragging and dropping visual elements

  • Dragging and dropping data

  • Dragging and dropping using layers

  • Data binding

  • Using the Tabular Data Control

  • Internet Explorer behaviors

  • Working with regular expressions

  • Cascading Style Sheets

  • Using absolute positioning

  • Using relative positioning

  • Changing style classes on-the-fly

  • Changing style sheets on-the-fly

  • Changing mouse cursors

  • Menus

  • XML and XSLT

  • Creating cookies and custom objects

  • Mouse trails

  • .NET and CGI programming

Here’s something that’s important to realize if you have an older browser: Note that not all examples will work in all browsers. Over time, browser manufacturers introduce new features, and of course, we have to cover those new features as well as the old—which means that not all examples are going to work in every browser version.

In fact, cross-browser issues are a serious consideration when programming in JavaScript, as we’ll see throughout the book. As much as possible, I make it a point to indicate which examples will work in which browser; bear in mind that if you’re trying to use an example with a newer feature in an older browser, however, it might not work. For that matter, many features that work in the Internet Explorer do not work in the Netscape Navigator, and vice versa.

As you can tell, this is an issue that raises its head over and over in JavaScript. To enable you to handle version and browser differences, this book lists the versions and browsers that support the features that we’re going to see; so if an example doesn’t work for you, that’s the first thing to check. All the examples in the book were tested by three people—myself and two dedicated technical editors (working on different machines)—to make sure they work as advertised.


I use one convention in this book that you should be aware of. When I add a new section of code, or want to emphasize something in code, I mark it like this for emphasis (this is from Chapter 4):

        <TITLE>Our first script!</TITLE> 

        <H1>Here we go!</H1> 
       <SCRIPT LANGUAGE="JavaScript">
					document.write("Hello from JavaScript!")
					// -->

That’s it. We’re ready to go. If you have comments, I encourage you to write to me, in care of New Riders. This book is designed to be the new standard in JavaScript, more complete and more accessible than ever before. Please do keep in touch with me with ways to improve it and to keep it at the forefront. If you think this book lacks anything, let me know—I’ll add it, because I want to make sure this book stays on top. Thanks and happy programming!

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint