Beginning Web Programming - Code Examples

Back to main book index

Chapter 12: JavaScript Examples

Here are the examples for Chapter 12, which looks at practical JavaScript.

Form Validation

ch12-eg01.htmlBasic text inputs
ch12-eg02.htmlMore text inputs
ch12-eg03.htmlReplacing content in a textarea
ch12-eg04.htmlReplacing content with a Regular Expression
ch12-eg05.htmlTesting characters with a Regular Expression
ch12-eg06.htmlChecking an option from a select box has been selected
ch12-eg07.htmlChecking a radio button has been selected
ch12-eg08.htmlChecking that a checkbox has been selected
ch12-eg09.htmlDisabling a submit button until a checkbox has been checked

Form Techniques

ch12-eg10.htmlPassing focus to the first form element
ch12-eg11.htmlAuto tabbing between fields
ch12-eg12.htmlEnabling a text box when a user selects an option
ch12-eg13.htmlCase conversion
ch12-eg14.htmlStripping whitespace
ch12-eg15.htmlSelecting all of the text in a text area
ch12-eg16.htmlCheck all and uncheck all
Try it outAn email form

Misc JavaScripts

ch12-eg17.htmlImage Rollovers
ch12-eg18.htmlRandom content
ch12-eg29.htmlPopup windows

JavaScript Libraries

ch12-eg20.htmlScriptaculous animation effects
ch12-eg21.htmlScriptaculous drag and drop
ch12-eg22.htmlMochiKit sortable tables
ch12-eg23.htmlYUI Calendar
ch12-eg24.htmlYUI Autocomplete

Exercise

Exercise 1