Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Newbie question


  • From: peter at brunone.com (Peter Brunone)
  • Subject: [Javascript] Newbie question
  • Date: Wed Nov 30 19:21:24 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@xxxxxxxxxx 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