Beginning HTML, XHTML, CSS and JavaScript - 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.htmlSingle function validation
ch12_eg02.htmlReusable function validation
ch12_eg03.htmlReplacing content in a textarea
ch12_eg04.htmlReplacing content with a Regular Expression
ch12_eg05.htmlReplacing multiple items with a Regular Expression
ch12_eg06.htmlTesting characters with a Regular Expression
ch12_eg07.htmlChecking an option from a select box has been selected
ch12_eg08.htmlChecking a radio button has been selected
ch12_eg09.htmlChecking that a checkbox has been selected
ch12_eg10.htmlDisabling a submit button until a checkbox has been checked

Form Techniques

ch12_eg11.htmlPassing focus to the first form element
ch12_eg12.htmlAuto tabbing between fields
ch12_eg13.htmlEnabling a text box when a user selects an option
ch12_eg14.htmlCase conversion
ch12_eg15.htmlStripping whitespace
ch12_eg16.htmlSelecting all of the text in a text area
ch12_eg17.htmlCheck all and uncheck all
Try it outAn email form

JavaScript Libraries

ch12_eg18.htmlScriptaculous animated effects
ch12_eg19.htmlScriptaculous drag and drop sortable list
ch12_eg20.htmlCreating a lightbox
ch12_eg21.htmlCreating modal window
ch12_eg22.htmlMochiKit sortable tables
ch12_eg23.htmlYUI Calendar
ch12_eg24.htmlYUI Autocomplete

Exercise

Exercise 1