beautiful sky

Current Location: Home->Tutorials->CSS->Background Style

How to add extra functionality to forms using Javascript:

Current Location: Home->Tutorials->Javascript->Form

Javascript is used in form validation to make sure the user entered information correctly before it is submited. This helps mantain a high level of data integrity in databases and/or less errors in processing code. Javascript also lets you display helpful alerts to inform the user what information they have entered incorrectly and how they can fix it.

This Page includes examples and code on how to:
- Auto-clear text boxes on focus.
 

A text box that clears it's value as it is selected:



CODE: <input type="text" onfocus="javascript: this.value='';" value="select this text box"/>

For the text to come back when the box is empty use the following code:

CODE: <input type="text" onchange="javascript: if(this.value==''){this.value='the text is back in the box!'}" />


Main Links

Design Tools

Javascript Tutorials

CSS Tutorials

Design Tutorials

Links