Saturday, February 6, 2010

How to process Selection/Radio/Checkbox data using Javascript?

This corresponds with the previous post:

For Pull-Down Selection:

document.docname.variablename.selectedIndex

// Replace docname with your document name and variablename with your selection variable name such as country. The selectedIndex starts from 0 which is the first item in your pull down selection list.




For Radio Selection:

document.docname.variablename[index].checked

// If selected, this notation will become 1. The index starts from 0. If your radio selections have two items, the first one is 0 and the second item is 1.



For Checkbox Selection:

document.docname.variablename.checked

// If checked, this expression will become 1.


Walla!

No comments:

Post a Comment