Designing with JavaScript, 2nd Edition
Examples

by Nick Heinle and Bill Pena

This page lists the examples included in the second edition of Designing with JavaScript. Click on the "View Source" link to see the source code for each example or the "Run Example" link to run the example. Note that some examples don't have "Run Example" links because the example is a secondary page of another example or it is just an example fragment that doesn't do anything.

Example 1-1: Code for adding status bar text to a link View Source Run Example
Example 1-2: Improved code for adding status bar text to a link View Source Run Example
Example 1-3: The night and day script View Source Run Example
Example 1-4: Connecting number values to day names View Source Run Example
Example 2-1: Loading a new page in the current window View Source Run Example
Example 2-2: Creating a button in an HTML form View Source Run Example
Example 2-3: Loading a new page when the form button is clicked View Source Run Example
Example 2-4: Creating back and forward buttons View Source Run Example
Example 2-5: Opening a new window View Source Run Example
Example 2-6: A link that closes a window View Source
Example 2-8: A form button that opens a new window when clicked View Source Run Example
Example 2-9: Adding an onClick event handler to a link View Source Run Example
Example 2-10: Using openWindow() with the JavaScript pseudo-protocol View Source Run Example
Example 2-11: Defining a function to open a window to a specific location View Source Run Example
Example 2-13: Creating a remote window View Source Run Example
Example 2-15: Redirecting links to the opener window View Source
Example 2-17: Creating a remote search window View Source
Chapter 2 Writing Functions Sidedar, Hello Example View Source Run Example
Chapter 2 Writing Functions Sidebar, Hello Name Example View Source Run Example
Example 3-1: The frameset for the Safari home page View Source Run Example
Example 3-2: Opening a document in the main frame View Source
Example 3-3: Code for a frameset that can’t be framed View Source Run Example
Example 3-4: Function to change the contents of two frames with one click View Source
Example 3-5: Function for changing three frames with one click View Source
Example 3-9: The full content rotation system View Source Run Example
Example 3-10: Frameset for auto-scrolling viewer View Source Run Example
Example 3-15: The complete auto-scrolling panoramic viewer View Source
Example 4-1: A simple form containing a text input field and a submit button View Source Run Example
Example 4-4: The complete Madlibs script View Source Run Example
Example 4-7: The entire Send Us a Message script View Source Run Example
Example 4-12: The complete form validation script View Source Run Example
Example 4-13: The isInt() function View Source Run Example
Example 4-14: The isAlpha() function View Source Run Example
Example 4-15: The isPhone() function View Source Run Example
Chapter 4 Regular Expressions Sidebar, isInt() Example View Source Run Example
Chapter 4 Regular Expressions Sidebar, isAlpha() Example View Source Run Example
Chapter 4 Regular Expressions Sidebar, isPhone() Example View Source Run Example
Chapter 4 Regular Expressions Sidebar, isEmail() Example View Source Run Example
Example 5-3: A page with a random tagline View Source Run Example
Example 5-4: Printing fully formatted dates View Source Run Example
Example 5-8: Source code for the complete jumpin’ jive script View Source Run Example
Example 6-4: Partial HTML document with version detection View Source
Example 6-5: Browser detection for a simple rollover script View Source Run Example
Example 6-6: Simple browser detection for DHTML View Source
Example 6-7: HTML for the single-frame method for a DHTML page View Source
Example 6-8: A simple form that uses a single style sheet View Source Run Example
Example 6-9: Using browser detection to apply the appropriate style sheet View Source Run Example
Example 6-11: Code for a Flash detection script View Source
Example 6-12: Is the platform Windows 98? View Source Run Example
Example 7-1: Changing an image using onMouseOver and onMouseOut View Source Run Example
Example 7-6: Complete source for the rollover page View Source
Example 7-7: Changing two images with one event View Source
Example 7-12: Complete code for the billboard rotation system View Source Run Example
Example 8-5: Template for saving, retrieving, and deleting cookies View Source Run Example
Example 8-10: Source code for the welcome application View Source Run Example
Example 8-12: Source code for a form that remembers View Source Run Example
Example 8-16: Source code for the entertainment choices page View Source Run Example
Example 9-1: Rollover style changes View Source Run Example
Example 9-4: Source code for the dynamic CSS toolbar View Source Run Example
Example 9-5: Defining a simple layer View Source Run Example
Example 9-10: Source code for the tabbed folder interface View Source Run Example
Example 9-11: Browser detection for standard DHTML View Source
Example 10-3: Source code for the DHTML drop-down menus View Source Run Example
Example 10-6: Source code for the DHTML sliding tab View Source Run Example
Example 10-10: Source code for the scrolling news example View Source Run Example
Example 11-7: A page that uses Car objects View Source Run Example
Example 11-13: Source code for the quiz script View Source Run Example
Example 11-20: Source code for the relational menu script View Source Run Example
Example 11-23: Source code for xbStyle sliding tab View Source Run Example