
|
|
|||
Looping through form elements using JavaScriptBy Amrit Hallan2005-12-09
Looping through form elements using JavaScript You can loop through all the form fields, their names and values using the following JavaScript code:
An example of looping through all the form fields could be checking and unchecking all the check boxes present on a page (checking all the records to delete, or adding all the items to a shopping cart, for instance). First you have the two “Check All” and “Uncheck All” links:
Now the code that loops through all the elements, checks whether it’s a checkbox and check or uncheck it if it is a checkbox:
Both the JavaScript functions above loop through the form elements, check their type and check and uncheck them accordingly. Tutorial Pages: » Looping through form elements using JavaScript |
||||
| About the NetVisits, Inc Network | Write For Us | Advertise Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy. |
Visit other NetVisits, Inc. sites: |