|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Select all checkbox
Hi everybody
I want to make a checkbox that if I check it, it will automatically check a bunch of other checkbox exactely like in hotmail, where you can check all your mail in one shot. I would also know How can I retrieve which mail for example have been checked? I don't want to use the get method with the checkbox because I don't want it to be displayed in the URL also like in hotmail... How they do that? Thank you very much Johnjohn |
|
#2
|
||||
|
||||
|
The tricky part about passing checkbox information via get or post is that if the box isn't checked it doesn't exist... Unlike select boxes or text boxes that send NULL values, checkboxes generally don't... so depending on which server side language you're using, you may need to check if the checkbox value was posted [this would mean it was checked]
As far as checking all boxes using Javascript, here's an example using DOM... I tested it in Firefox 1.0 and IE6 Code:
<html>
<head>
<script language="javascript">
function checkAll(){
for (var i=0;i<document.forms[0].elements.length;i++)
{
var e=document.forms[0].elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox'))
{
e.checked=document.forms[0].allbox.checked;
}
}
}
</script>
</head>
<body>
<form>
<input type="checkbox" value="on" name="allbox" onclick="checkAll();"/> Check all<br />
<h3>Fruit</h3>
<input type="checkbox" value="on" name="apples" /> Apples<br/>
<input type="checkbox" value="on" name="oranges" /> Oranges<br/>
<input type="checkbox" value="on" name="bananas" /> Bananas<br/>
</form>
</body>
</html>
|
|
#3
|
|||
|
|||
|
Do You Know how to do it using PHP ?
Thanks for the help ktaufik Quote:
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Select all checkbox |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|