faqts : Computers : Programming : Languages : JavaScript : Forms : Checkboxes

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

59 of 81 people (73%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How to make a check box check or uncheck a group of checkboxes on a form?

Jan 18th, 2002 13:19
Arsen Yeremin, Matt Ruby,


<html>
<head>
	<title>Check All</title>
  <script>
  function DoToAll(obj_input)
  { bol_is_checked = (obj_input.checked)?true:false
    for (x=0;x<obj_input.form.length;x++)
    {  obj_input.form.elements[x].checked = bol_is_checked;
    }
  }
  </script>
</head>
<body>
  <form>
     all:  
     <input type="checkbox" onclick="DoToAll(this)"><br>
     <input type="checkbox"><br>
     <input type="checkbox"><br>
     <input type="checkbox"><br>
     <input type="checkbox"><br>
   </form>
</body>
</html>