my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes Function to select all Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Function to select all" Watch "Function to select all" New topic
Author

Function to select all

Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
I have this function

It is suppose to �check all� check boxes when the link is selected but it isn�t working in IE (or FF but IE is what I am trying for). I tried using FF error console but I don�t get any errors�I know the name of the checkboxes are all the same but that is needed for other functionality.
Any ideas on what could be the cause?

Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Do not check for the value of on/off, look at the check state of the checkbox.

Eric
Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
OK-I tried that it makes the code cleaner but it still fails to function...
[code]

function CheckAll() {

var i;
//Check all or Uncheck all awards...
for ( i in ListRecordForm.p_search_award_type ) {
if ( ListRecordForm.p_search_award_type[i].checked ) //turn them off
ListRecordForm.p_search_award_type[i].checked = false;
else //turn them off
ListRecordForm.p_search_award_type[i].checked = true;
}



}
[code]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Or you could save yourself some gray hair and do it with jQuery. The code to check all checkboxes:


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Function to select all
 
Similar Threads
Accessing the full path of a file uploaded via an HTML form
Getting error on response.getParameter("");
Radio Select and Other
IE doesn't return value of submit button?
Check All button for all spring check boxes array