Check/uncheck all works except in fieldset?
Posted: Tue Dec 26, 2006 10:33 pm
feyd | Please use
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
This script works except when you have a fieldset element. What do we have to modify in the script to get it to work with the fieldset?
- John
[syntax="html"]<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Check Boxes</title>
<script type="text/javascript">
function Checkall(form){
for (var i = 1; i < form.elements.length; i++){
eval("form.elements[" + i + "].checked = form.elements[0].checked");
}
}
</script>
</head>
<body>
<form>
<fieldset>
<table>
<colgroup style="width: 20px;"></colgroup>
<colgroup width="33%"></colgroup>
<colgroup width="33%"></colgroup>
<colgroup width="33%"></colgroup>
<thead>
<tr>
<td><input onclick="Checkall(this.form);" type="checkbox" value="" />
</td>
<td>From
</td>
<td>Subject
</td>
<td>Recieved
</td>
</tr>
</thead>
<tfoot>
<tr>
<td><input type="checkbox" value="" />
</td>
<td>From
</td>
<td>Subject
</td>
<td>Recieved
</td>
</tr>
</tfoot>
<tbody>
<tr>
<td><input type="checkbox" value="" />
</td>
<td>From
</td>
<td>Subject
</td>
<td>Recieved
</td>
</tr>
<tr>
<td><input type="checkbox" value="" />
</td>
<td>From
</td>
<td>Subject
</td>
<td>Recieved
</td>
</tr>
<tr>
<td><input type="checkbox" value="" />
</td>
<td>From
</td>
<td>Subject
</td>
<td>Recieved
</td>
</tr>
</tbody>
</table>
</fieldset>
</form>
</body>
</html> feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]