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 3400294
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:52:32+00:00 2026-05-18T04:52:32+00:00

I have a Check All box wherein when the user will tick it, all

  • 0

I have a Check All box wherein when the user will tick it, all the items under it will be ticked. It works fine in Firefox but won’t perform the Check All function in chrome.

This is the JS function:

function Check(chk, num)   
{   
    if(chk.value=="Check all"){   
        for (i = 0; i <= num; i++){   
            chk[i].checked = true ;   
        }
        chk.value="UnCheck all";   
    }else{

        for (i = 0; i <= num; i++){
            chk[i].checked = false ;
        }
        chk.value="Check all";
    }
}

HTML:

<form target="_blank" action="" method="post" id="myform" name="myform"> 
    <input type="checkbox" value="Check all" onclick="Check(document.myform.Product A, 9)" id="Fujitsu" name="Fujitsu"> Select All 
    <input type="hidden" value="1" name="product_id[1]"> 
    <input type="checkbox" value="Product 1" id="Product 1" name="product[1]">Product A -Product 1 
    <input type="hidden" value="2" name="product_id[2]"> 
    <input type="checkbox" value="Product 2" id="Product 2" name="product[1]">Product A -Product 2 
</form>
  • 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-18T04:52:32+00:00Added an answer on May 18, 2026 at 4:52 am

    For me both Firefox and Chromium crash on “document.myform.Product A”. Here is your code a little modified to work:

    function Check(form, all, chk, num)
    {
        if(form[all].value=="Check all"){
            for (i = 1; i <= num; i++){
                form[chk + i].checked = true ;
            }
            form[all].value="UnCheck all";
        }else{
    
            for (i = 1; i <= num; i++){
                form[chk + i].checked = false ;
            }
            form[all].value="Check all";
        }
    }
    

    and HTML:

    <form target="_blank" action="" method="post" id="myform" name="myform">-
        <input type="checkbox" value="Check all" onclick="Check(document.myform, 'Fujitsu',  'Product_' , 2)" id="Fujitsu" name="Fujitsu"> Select All-
        <input type="hidden" value="1" name="product_id[1]">-
        <input type="checkbox" value="Product 1" id="Product_1" name="product[1]">Product A -Product 1-
        <input type="hidden" value="2" name="product_id[2]">-
        <input type="checkbox" value="Product 2" id="Product_2" name="product[1]">Product A -Product 2-
    </form>
    

    But you can do cleaner code to do the same thing:

    function Check(form, action)
    {
        var l = form.getElementsByTagName("input");
        for (var i = 0; i < l.length; ++i)
            if (l[i].type == "checkbox") l[i].checked = action;
    }
    

    and HTML:

    <form target="_blank" action="" method="post" id="myform" name="myform">-
        <input type="checkbox" value="Check all" onclick="Check(document.myform, this.checked)" id="Fujitsu" name="Fujitsu"> Select All-
        <input type="hidden" value="1" name="product_id[1]">-
        <input type="checkbox" value="Product 1" id="Product_1" name="product[1]">Product A -Product 1-
        <input type="hidden" value="2" name="product_id[2]">-
        <input type="checkbox" value="Product 2" id="Product_2" name="product[1]">Product A -Product 2-
    </form>
    

    It would be even better if you used a library with CSS selectors like jQuery.

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

Sidebar

Related Questions

I have a function CheckMobile(MobNumber) and it will check all duplicate record of MobNumber
hello friends i have a check box list which contains all the courses kept
I have Five check boxes Search All Template 1 Template 2 Template 3 Template
I have a form and one of the fields is a check-all-that-applies type field
I have directory with > 1000 .html files, and would like to check all
How can I check whether all JavaScript functions have loaded properly on a page?
Hey all, this is the code i have to check for a day thats
I have a list of dictionaries. I need to check if all the dictionaries
Hi all I have this code to check if an item from a textbox
If I have two different arrays and all I can do is check whether

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.