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: schalk at volume4.com (Schalk)
  • Subject: [Javascript] Newbie question
  • Date: Thu Dec 1 12:39:59 2005

Peter Brunone wrote:
> 	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
> 		}
> 	}
Thanks Peter, that will help but, maybe I should rephrase my question. I have a form and at the end I give the user between 2 - 3 payment options. When they click on one of these (radio buttons) the appropriate form fields should show below these radio buttons.

If for example the user chooses credit card, onlt fields relevant to a credit card should show and all others hidden and so forth. Thanks!

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