[Javascript] turning on checkboxes
Filipiak, Bob (Contractor)
filipiab at atsc.army.mil
Fri Aug 10 10:14:28 CDT 2001
function selectAll(){
for ( var i =0; i < document.forms[0].length; i++){
if ( document.forms[0].element[i].type == "checkbox"){
document.forms[0].element[i].checked = TRUE;
}
}
}
HTH
Bob Filipiak (Contractor)
MCP
-----Original Message-----
From: susan at plonka.com [mailto:susan at plonka.com]
Sent: Friday, August 10, 2001 10:48 AM
To: javascript at LaTech.edu
Subject: [Javascript] turning on checkboxes
I'm trying to figure out how to make a "Select All checkboxes" button
function.
The checkboxes are generated dynamically in a loop from reading a
database and their names correspond to the memberID. I don't know how
many, that's dynamic too.
I want to be able to get the checkbox names and turn them all on with
this button.
<script language="JavaScript">
function selectAll() {
document.members.cb1050.checked = true
}
<script>
<body><table> <!--- SQL stuff -->
<% do while not connMembers.eof %>
<tr><td>
<input type="checkbox" name="<%= connMembers(0) %>">
</td></tr>
<% connMembers.movenext
Loop %>
</table>
<table width="500"><tr><td width="100%" align="center">
<input type="button" value="Select All" onclick="selectAll()">
</td></tr></table>
</body>
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010810/d2f2ff74/attachment.htm>
More information about the Javascript
mailing list