»
AnglaisFran�aisVietnamien

Imprimer - Onload Mobilité Radio Button Groupes - JavaScriptBank.com

Version compl�te: jsB@nk » Form » Checkbox » Onload Mobilité Radio Button Groupes
URL: https://www.javascriptbank.com/onload-disabled-radio-button-groups.html

Onload Mobilité Radio Button Groupes © JavaScriptBank.comJe utiliser ce Le code JavaScript si vous avez besoin de désactiver des groupes de boutons radio sur la page où il est déjà chargé. Ce code peut être setuped bouton radio pour beaucoup de groupes sur une seule page. Très facile à personnaliser.

Version compl�te: jsB@nk » Form » Checkbox » Onload Mobilité Radio Button Groupes
URL: https://www.javascriptbank.com/onload-disabled-radio-button-groups.html



JavaScript
<script type="text/javascript"><!--// Created by: Greg Burghardt :: http://www.webdeveloper.com/forum/showthread.php?t=158022function disableRadioGroups() {  var forms, el, radioGroup;  var i = end = j = elsEnd = rg = rgEnd = 0;    if (document.getElementsByTagName) {    forms = document.getElementsByTagName('form');    /* Loop through all the FORMs */    for (i, end = forms.length; i < end; i++) {      /* Loop through each form element */      for (j = 0, elsEnd = forms[i].elements.length; j < elsEnd; j++) {        el = forms[i].elements[j];        /* If this is a checked, enabled radio button in a radio group... */        if (!el.disabled            && el.nodeName === 'INPUT'            && el.type == 'radio'            && el.checked            && forms[i].elements[el.name].length) {          radioGroup = forms[i].elements[el.name];          /* Loop through radio group and disable buttons */          for (rg = 0, rgEnd = radioGroup.length; rg < rgEnd; rg++) {            radioGroup[rg].disabled = true;          }        }      }    }  }}// Multiple onload function created by: Simon Willison// http://simonwillison.net/2004/May/26/addLoadEvent/function addLoadEvent(func) {  var oldonload = window.onload;  if (typeof window.onload != 'function') {    window.onload = func;  } else {    window.onload = function() {      if (oldonload) {        oldonload();      }      func();    }  }}addLoadEvent(function() {  disableRadioGroups();});//--></script>


HTML
<form>Are you a member?<br><input disabled="disabled" name="member" value="1" checked="checked" type="radio">Yes<br><input disabled="disabled" name="member" value="2" type="radio">No<br><input disabled="disabled" name="member" value="3" type="radio">I'm Not Sure<br><p>Will you attend the national event?<br><input name="conf" value="1" type="radio">Yes<br><input name="conf" value="2" type="radio">No<br></p></form>