Re: Possible for javascript to handle 2 values from a radio button?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Possible for javascript to handle 2 values from a radio button?

From: Martin Honnen <mahotrash@yahoo.de>
Date: Fri Jul 29 2005 - 19:07:50 CEST

lee@dnuk.com wrote:

> I've been successful using the "label" attribute (I've simplied the
> example below):
>
> <input type="radio" name="group1" value="3" label="Cheese"
> checked>Cheese<br>
> <input type="radio" name="group1" value="5" label="Meat">Meat<br>
> <input type="radio" name="group1" value="15" label="Bread">Bread<br>
>
> But this only works in Internet Explorer, it will not work in
> Mozilla/Firebox.

I don't see any script in that example so if anything does not work or
does not work as you want it why do you ask in a JavaScript group?

> Does anyone know how I can refence 2 values per radio button in
> javascript?

I am not sure I understand what you are looking for. Do you want to read
out the value of the label attribute of an element? Then use
   element.getAttribute('label')
so assuming you have your radio button group inside of a
   <form name="formName">
then you can access the first radio button as
   var radioButton = document.forms.formName.elements.group[0];
   if (radioButton && radioButton.getAttribute) {
     alert(radioButton.getAttribute('label'));
   }

-- 
	Martin Honnen
	http://JavaScript.FAQTs.com/
Received on Tue Oct 18 03:03:35 2005