Javascript: Accéder aux valeurs des RadioButton et CheckBox

Author:

Javascript: Accéder aux valeurs des RadioButton et CheckBox
Download

 
 
   

if (window.addEventListener) 
{
      window.addEventListener("load",setupEvents,false);
   } else if (window.attachEvent) {
      window.attachEvent("onload", setupEvents);
   } else {
      window.onload=setupEvents;
}

function setupEvents(evnt) {
   document.myForm.onsubmit=checkForm; 
}

function checkForm(evnt) 
{
   var buttons = document.myForm.radiogroup;

   for (var i = 0; i < buttons.length; i++) {
      if (buttons[i].checked) {
         alert(buttons[i].value);
      }
   }
}
     
     


Option 1
Option 2
Option 3

Cet article Javascript: Accéder aux valeurs des RadioButton et CheckBox est apparu en premier sur .