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 May 15th, 2007, 12:06 PM
nevillemehta nevillemehta is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: India
Posts: 64 nevillemehta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 44 m 17 sec
Reputation Power: 6
Check and Uncheck...

Hi,

I am using this script which will check and uncheck all checkboxes for me on just one click.

Code:
<html>
<head>
<script language="javascript">
function checkall()
{
	var dels = document.deleteform['todeletelist[]'];
	for (var i = 0; i < dels.length; i++)
	{
		dels[i].checked = true;
	}
}

function uncheckall()
{
	var dels = document.deleteform['todeletelist[]'];
	for (var i = 0; i < dels.length; i++)
	{
		dels[i].checked = false;
	}
}
</script>
</head>

<body>
<a onClick="checkall();">Select All</a>
<a onClick="uncheckall();">None</a>

<form name="deleteform">
<input type="checkbox" name="todeletelist[]" value="1" />
<input type="checkbox" name="todeletelist[]" value="2" />
<input type="checkbox" name="todeletelist[]" value="3"/>
</form>
</body>
</html>


Here is all the code related to the same. I am generating all these checkboxes dynamically.

- It works OK, till i try to check or uncheck all checkboxes when there is just one checkbox in the todeletelist[]. You could just delete two checkboxes out of the three on top and check again.

- Is there anyway i can pass 'todeletelist[]' (or the name of the array) as a param to both the methods (checkall and uncheckall)?

Any solutions for these?

Thanks
Neville

Reply With Quote
  #2  
Old May 27th, 2007, 04:15 AM
nevillemehta nevillemehta is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: India
Posts: 64 nevillemehta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 44 m 17 sec
Reputation Power: 6
Hello all,

Was eagerly awaiting a response on this one. Let me know if i need to provide more information.

Thanks

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Check and Uncheck...


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway