function todos(valor) { for (var i = 0, total = document.forms[0].elements; i < total.length; i ++) total[i].checked = valor; }