...

View Full Version : check box



amir
07-16-2005, 02:55 PM
hi all

Example: mail.yahoo.com
when we go to inbox page of mail.yahoo.com, if we have messages in our inbox, they come in the form of checkboxes one after another.
if we wanna delete one message, we select the checkbox of that message and press the delete button.
if we wanna delete all messages then we select the top checkbox and all the check boxes get selected.
i wanna know this how to select all check boxes on the selection of one check box.
Regards,
Aamir

zro@rtv
07-16-2005, 03:31 PM
http://www.google.com/search?q=select+all+checkbox

is java script an option?
is there a link?
does that link answer yr question?

coothead
07-16-2005, 03:31 PM
Hi there amir,

try this little script, it may give you some ideas...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224">
<html>
<head>
<title>check all</title>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<meta name="Content-Style-Type" content="text/css">

<script type="text/javascript">
<!--

var chk=document.getElementsByTagName('input');

function checkAll() {
if(document.forms[0][0].checked==true) {
for(i=0;i<chk.length;i++) {
if(chk[i].type=='checkbox') {
chk[i].checked=true;
}
}
}
else {
for(i=0;i<chk.length;i++) {
if(chk[i].type=='checkbox') {
chk[i].checked=false;
}
}
}
}
//-->
</script>

</head>
<body>

<form action="#">

<ul>
<li><input type="checkbox" onclick="checkAll()"><label>check all</label></li>
<li><input type="checkbox"></li>
<li><input type="checkbox"></li>
<li><input type="checkbox"></li>
<li><input type="checkbox"></li>
<li><input type="checkbox"></li>
</ul>

</form>

</body>
</html>
reason for edit - original script did not allow for the unchecking of the check all box

coothead



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum