check = (function() { var o = null; return function(id) { if (o) { o.disabled = true } if (id) { id = document.getElementById(id) || id; id.disabled = false; o = id } else { throw new Error("Wrong argument"); } } })();
check('sans_serrure');
<label> Sans serrure </label> €
check = (function() { var o = null; return function(id) { if (o) { o.disabled = true; } id = document.getElementById(id) || id; if (id) { id.disabled = false; o = id; } else { throw new Error("Wrong argument"); } } })();
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questioncheck = (function() { var o = {}; return function(name, id) { if (o[name]) { o[name].disabled = true; } id = document.getElementById(id) || id; if (id) { id.disabled = false; o[name] = id; } else { throw new Error("Wrong argument"); } } })();
check('serrure','sans_serrure');
check = (function() { var o = {}; return function(name, id) { var a = arguments, i = (a.length > 2) ? !!a[2] : true; if (o[name] && o[name] != id) { o[name].disabled = i; } id = document.getElementById(id) || id; if (id) { id.disabled = !i; o[name] = id } else if(!id){ throw new Error("Wrong argument"); } } })();
check('serrure','sans_serrure', this.checked);
<input id="Option_1" onclick="check('option01','pattes', this.checked)" type="checkbox" <input id="Option_2" onclick="check('option02','oculus', this.checked)" type="checkbox" <input id="Option_3" onclick="check('option03','imposte', this.checked)" type="checkbox" <input id="Option_4" onclick="check('option04','judas', this.checked)" type="checkbox"
etc. etc.