JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 6th, 2004, 11:29 AM
johnjohn johnjohn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 3 johnjohn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old December 6th, 2004, 02:11 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
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>

Reply With Quote
  #3  
Old February 4th, 2005, 08:40 PM
ktaufik ktaufik is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 4 ktaufik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 27 m 48 sec
Reputation Power: 0
Do You Know how to do it using PHP ?
Thanks for the help

ktaufik

Quote:
Originally Posted by MadCowDzz
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>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Select all checkbox


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap