Page 1 of 1

2 radio buttons

Posted: Tue Feb 03, 2009 6:57 am
by killbaz
Hello to all...

I made 2 radio buttons

<input type="radio" name="rad" value="val">
<input type="radio" name="rad2" value="val2">


How can i make when i will check the first radio button , automatically check the second?

thanks

Re: 2 radio buttons

Posted: Tue Feb 03, 2009 10:10 am
by pickle
Give them the same name.

Re: 2 radio buttons

Posted: Tue Feb 03, 2009 10:16 am
by killbaz
not working :(

but i don't want like this :(

Code: Select all

<input type="radio" name="radio1" value="1" onclick="selectAnother();" id="radio1">
<input type="radio" name="radio2" value="1" id="radio2">
<script>
      function selectAnother()
      {
         var radio1 = document.getElementById('radio1');
         var radio2 = document.getElementById('radio2');
         if(radio1.checked)
         {
            radio2.checked = true;
         }
      }
</script>

edit:
i didnt test correctly :))
it worked ... but not like i want to , but still, it's good :D thx :)