[Javascript] Newbie question

Peter Brunone peter at brunone.com
Wed Nov 30 19:08:58 CST 2005


	You can get any radio button with

var myButton = document.getElementById("radioButtonID")

and check its .checked property (true or false)...

Or you can get an entire set (multiple radio buttons sharing a name)
with 

var myButtons = document.forms.formName.radioButtonName

This yields an array, which you can iterate through

for(var i=0;i<myButtons.length;i++) {
	if(myButtons[i].checked) {
		//do something with myButtons[i].value, 
		// which is probably how you identify it
		}
	}

Hope that helps...

Peter

-----Original Message-----
From: javascript-bounces at LaTech.edu On Behalf Of Schalk

Greetings All

I have some forms coded up and now I need to show certain data based on 
which radio button was clicked. Does anyone have any pointers, url's to 
tutorials? Anything that would be of help would be greatly appreciated. 
Thank you.

-- 
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers






More information about the Javascript mailing list