View your Shopping CartFrequently Asked QuestionsEmail Us
Home | About Us | Contact Us
SmartWebby.com provides best web design & web programming services globally
We specialize in Rapid Web Design, ASP.net, ASP and PHP web programmingBest Web Design, Best Web Programming, Global Service Provider - Dependable Professionals to build your website right!

Resetting forms using an Image Button

In forms when using text boxes or text areas and check boxes you might need a reset button that is not the usual gray HTML button. For this you can use an image field and a small JavaScript function as given below.

Note: This button will reset only text boxes,text areas and check boxes as list boxes and option buttons don't usually require resetting. After resetting the form the cursor will set the focus to the first field in the form.

Example

Example of resetting a form using an image button (image field)

  Name
  Address
  Email Address
 
Get free stuff and free info. Just check the boxes that interests you.
  Free Stuff Fitness
  Clothing     Magazines
  Cosmetics   Movies 
  Entertainment   Music 

Cut and Paste Code

Cut 'n' paste code for the above Example

JavaScript Code
HTML Code
Cut and paste the below code and then create your other fields inside the already created form. For the reset button in the given code just change the path to your image button.

Explanation of the Code

There is just one JavaScript function ResetForm. The logic behind the functioning of this code is very simple.