Is JavaScript for You? -- What Can JavaScript Do? -- What Are the Alternatives to JavaScript? -- CGI Scripting -- Java -- VBScript -- JavaScript's Limitations -- JavaScript Can't Talk to Servers -- JavaScript Can't Create Graphics -- JavaScript Works Differently in Different Browsers -- Where JavaScript Goes on Your Web Pages -- Dealing with Older Browsers -- Hiding JavaScript from Older Browsers -- Your First JavaScript -- Using Variables and Built-In Functions to Update Your Web Pages Automatically -- Variables Store Information -- Syntax -- Naming Variables -- Arithmetic with Variables -- Moving On -- Write Here Right Now: Displaying Results -- Line-by-Line Analysis of Figure 2-3 -- Strings -- More About Functions -- The alert() Function -- The prompt() Function -- Parameters -- Writing the Date to Your Web Page -- Built-in Date Functions -- Date and Time Methods -- Writing the Date: The Code -- How NPR Did It -- Some Picky Notes About the NPR Script -- Give the Browsers What They Want -- Netboost.com: A Real-World Example of Browser Detection -- Browser Detection -- Redirecting Visitors to Other Pages -- If-then Statements -- Booleans -- Use Two Equal Signs in if-then Statements -- If-then-else Statements -- If-then-else-if Statements -- The or and and Operators -- Or -- And -- Putting It All Together -- When and Where to Place Curly Brackets -- Netboost's Redirection -- Rollovers: Everyone's Favorite Javascript Trick -- Triggering Events -- Event Types -- Quotes in JavaScript -- Clicking the Link to Nowhere -- Swapping Images -- Working with Multiple Images -- What's with All the Dots? -- Object Properties -- You Can't Put Events Inside Image Tags -- Image Swap Gotchas -- A Closer Look at the Rollover -- Another Way to Check for Image Swappability -- Real-World Example: How the ACLU Swaps Images -- ACLU's Browser Detection -- The ACLU Site's Preload -- The ACLU Site's Image Swap -- Opening and Manipulating Windows -- Windows Examples from the Real World -- Opening Windows -- Manipulating the Appearance of New Windows through open() Parameters -- Some Browsers Open Windows Differently -- Closing Windows -- Using the Right Name: How Windows See Each Other -- Moving Windows to the Front and Back of the Screen -- Window Properties -- The status Property -- The opener Property -- Advanced Window Tricks -- Resizing Windows -- Moving Windows -- Getting Functional: Writing Your Own Javascript Functions -- Functions as Shortcuts -- Basic Structure of JavaScript Functions -- Naming Your Functions -- Parentheses and Curly Brackets -- An Example of a Simple Function -- Simple Functions in the Real World -- Analysis of Tripod's Pop-up Ad Code -- Writing Flexible Functions -- Parameters -- Using More Than One Parameter -- A Real-World Example of a Function with Parameters -- Analysis of the ParentsPlace Code -- Getting Information from Functions -- Analysis of Figure 6-12 -- Dealing with Y2K -- Analysis of Figure 6-15 -- Defining Variables Properly -- The True Nature of var -- Final Words About Functions -- Giving and Taking Information with Forms -- Real-World Examples of Forms -- Form Basics -- Text Fields -- Buttons, Checkboxes, and Radio Buttons -- Select Elements -- Textarea -- Final Form Comments -- Forms and JavaScript -- Naming Form Elements -- Naming Radio Buttons -- Naming Options -- Reading and Setting Form Elements -- Reading Information from Text Fields -- Setting the Value of a Text Field -- Reading and Setting Textareas -- Reading and Setting Checkboxes -- Reading and Setting Radio Buttons -- Reading and Setting Pull-down Menus and Scrollable Lists -- Handling Events Using Form Elements -- Make This a Shortcut -- Using Pull-down Menus as Navigational Tools -- How Sun Microsystems Creates Its Pull-down Navigation Tool -- Keeping Track of Information with Arrays and Loops -- Real-World Examples of Arrays -- JavaScript's Built-in Arrays -- Why Built-in Arrays Are Helpful -- Figuring Out How Many Items an Array Contains -- Going through Arrays -- While Loops -- While Loops and Arrays -- Using array.length in Your Loop -- An Incremental Shortcut -- Beware of Infinite Loops -- for Loops -- How HotMail Checks Off All the Message Boxes -- Line-by-Line Analysis of Figure 8-11 -- Creating Your Own Arrays -- Dealing with Netscape 2.0 Arrays -- How Ask Jeeves Uses Arrays It Has Created -- Line-by-Line Analysis of Figure 8-14 -- Streamlined Jeeves -- Loops Can Nest -- Creating Arrays as You Go Along -- Associative Arrays -- Analysis of Figure 8-19 -- Timing Events -- Real-World Examples of Timing Events -- Setting an Alarm with setTimeout() -- Canceling an Alarm with clearTimeout() -- Line-by-Line Analysis of Figure 9-3 -- Timing Loops -- Line-by-Line Analysis of Figure 9-5 -- Using parselnt() for MSIE 4 and Up -- Clearing Out a Time-out Before You Set a New One -- Declaring Variables That Hold Time-outs Outside Functions -- Building a Clock with Timing Loops -- Line-by-Line Analysis of Figure 9-8 -- How NASA's Clock Works -- Line-by-Line Analysis of Figure 9-10 -- NASA's Calculations -- A Timed Slide Show -- Line-by-Line Analysis of Figure 9-12 -- A Safer Version of rotatelmage() -- Frames and Image Maps -- A Real-World Example of Frames and Image Maps -- Frames -- Frames and JavaScript -- Frames and Image Swaps -- Changing the Contents of Two Frames at Once -- Frames Inside Frames -- JavaScript and Frames Inside Frames -- Frame Busting -- Using Frames to Store Information -- Image Maps -- Image Map Basics -- Image Maps and JavaScript -- Frames and Image Maps: How Salon's Bug-Eating Script Works -- Salon's Nested Frames -- Salon's Image Map -- The changeMe() Function -- Validating Forms, Massaging Strings, and Working With CGI -- A Real-World Example of Form Validation -- Making Sure a Visitor Has Filled Out a Form Element -- Line-by-Line Analysis of Figure 11-2 -- String Handling -- indexOf() and lastIndexOf() -- charAt() -- substring() -- split() -- Bringing It Together: Pets.com's Form Validators -- Analysis of Figure 11-9 -- The alertError() Function -- Cookies -- A Real-World Example of Cookies -- What Are Cookies? -- What Cookies Can and Can't Do -- Working with Cookies -- Setting Cookies -- Reading Cookies -- Resetting Cookies -- Setting More Than One Piece of Information -- Setting the Duration of a Cookie -- Who Can Read the Cookie? -- The Whole Cookie -- Setting Multiple Cookies -- Cookie Libraries -- Webmonkey's Code for Accessing Multiple Cookies -- Shopping Cart Basics -- The readTheCookie() Function -- The checkOut() Function -- Dynamic Html -- Real-World Examples of DHTML -- CSS Basics -- The div Tag -- Positioning a div Tag with CSS -- Hiding a div -- Layering divs -- JavaScript and DHTML -- Line-by-Line Analysis of Figure 13-9 -- Making divs Move -- In Netscape -- In MSIE -- Cross-Browser -- Using setTimeout() and clearTimeout() to Animate a Page -- Line-by-Line Analysis of Figure 13-11 -- Using eval() to Work with More Than One div -- Pointing to a div with eval() -- What eval() Does -- How to Use eval() -- Making an Animated Race with eval() -- An Alternative to eval() -- Hierarchical Menus -- Line-by-Line Analysis of Figure 13-16 -- How to Fix Broken Code -- Debugging Techniques -- Your Browser's Built-in Bug Detector -- Printing Variables -- Debugging Beyond Alerts -- Common Programming Mistakes -- Incorrect Variable or Function Names -- Accidentally Using Reserved Words -- Use Two Equal Signs in Logical Tests -- Accidentally Quoting Variables or Forgetting to Quote Strings -- Fixing Bugs -- Copy Your Program First -- Fix One Bug at a Time -- Beware of Voodoo Coding -- Look for Similar Bugs -- If All Else Fails -- If It Still Doesn't Work ... -- Good Coding Practices -- Write the Comments -- Fill In the Code -- Now Go Forth and Code -- Beyond the Browser: Plug-Ins, Activex, Making Music, and Java -- Plug-ins and ActiveX -- How Netscape Deals with Plug-ins -- How MSIE Deals with Plug-ins -- Use a Plug-in Detection Library -- Making Music with Plug-ins -- Netscape's LiveAudio -- Microsoft's ActiveMovie Control -- JavaScript and Java.
0
"This isn't just a book of scripts for you to cut and paste into your HTML, only to find out that nothing works. "The Book of JavaScript will teach you how to use JavaScript to quickly add interactivity, animation and other tricks to your Web pages--on your own and without cut-and-paste solutions. Using real-world examples as a starting point, wild-man thau! shows you, step-by- step, how various scripts work and how to use them to produce the effects you want"--Publisher description.