Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6101523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:30:33+00:00 2026-05-23T13:30:33+00:00

Why is the first checkbox working but not the second, what am I doing

  • 0

Why is the first checkbox working but not the second, what am I doing wrong? :S

 <meta http-equiv="Content-type" value="text/html; charset=UTF-8" />

 <script type="text/javascript" language="javascript">
 function SetAllCheckBoxes(FormName, AreaID)
 {

 if(!document.forms[FormName])
 return;
 var objCheckBoxes = document.getElementById(AreaID).getElementsByTagName('input');
 if(!objCheckBoxes)
 return;
 var countCheckBoxes = objCheckBoxes.length;
 if(!countCheckBoxes)
 objCheckBoxes.checked = CheckValue;
 else
 for(var i = 0; i < countCheckBoxes; i++)
 objCheckBoxes[i].checked = false;
 }
 </script>


 </head>

 <div id="items">
  <input name="checkall" type="checkbox" onclick="SetAllCheckBoxes('SelectedItems','items');"><br>
 <form name="SelectedItems" action="" method="post">
 <b>Select/Unselect All</b><br>


 <input id="idGSSmodules" type="checkbox" name="GSS" >
 <label for="idmodules">GSS</label><br>
 <input type="checkbox" name="GTS" id="idGSSmodules">
 <label for="idmodules">GSS</label>
 <br>

 </div>

 <div id="itemss">
  <input name="checkall" type="checkbox" onclick="SetAllCheckBoxes('SelectedItemss','itemss');"><br>
 <form name="SelectedItemss" action="" method="post">
 <b>Select/Unselect All</b><br>


 <input id="idGSSmodules" type="checkbox" name="GSS" >
 <label for="idmodules">GSS</label><br>
 <input type="checkbox" name="GTS" id="idGSSmodules">
 <label for="idmodules">GSS</label>
 <br>

 </div>

 </form>

 </body>
 </html>

EDIT**************************************************************

How do I call the method on the form SetAllCheckBoxes(FormName, AreaID); In other words I would like to call the function whithout using a checkbox?

Tried this, but then I cant change the value of the checkboxes

 function unCheckBoxes(FormName, AreaID) {
     if(!document.forms[FormName])
     return;
     var objCheckBoxes = document.getElementById(AreaID).getElementsByTagName('input');
     if(!objCheckBoxes)
     return;
     var countCheckBoxes = objCheckBoxes.length;

     for(var i = 0; i < countCheckBoxes; i++)
     objCheckBoxes[i].checked = false;
 }
 function checkCheckBoxes(FormName, AreaID){
     if(!document.forms[FormName])
     return;
     var objCheckBoxes = document.getElementById(AreaID).getElementsByTagName('input');
     if(!objCheckBoxes)
     return;
     var countCheckBoxes = objCheckBoxes.length;


     for(var i = 0; i < countCheckBoxes; i++)
     objCheckBoxes[i].checked = true;
 }
checkCheckBoxes('locForm','locCheckboxes');
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:30:34+00:00Added an answer on May 23, 2026 at 1:30 pm

    Your two checkboxes have the same id, which is the true unique identifier (not name). The browser refuses to recognize two objects with the same id.

    Change your code to:

    <input id="GSS" type="checkbox" name="GSS">
    <label for="GSS">GSS</label><br/>
    <input type="checkbox" name="GTS" id="GTS">
    <label for="GTS">GSS</label> 
    

    EDIT: You will need to rename your second set of checkboxes to unique names, also. Each id on the page must be unique.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get the value of the first checkbox which is checked and
I use this code to determine checkbox width and height: var chk = $('input[type=checkbox]:first');
Can't figure out why this is not working. First time using :has_many => :through
First of all, I know how to build a Java application. But I have
I am working with windows application. I have a datagrid in vb.net. Its first
hi i have a datagridview whose first column (index = 0) is a checkbox
I'm trying to grab the first parent element that matches a class check, but
First, housekeeping: A quick review makes me think this isn't a duplicate but would
I am working on my first Adobe Flex application, and have a code section
I'm working on a CSS file and find the need to style text input

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.