Jump to content

On Body OnLoad Function the, The Checkboxes Never Checked


habib009pk

Recommended Posts

Dear Friends,

 

I have a problem i have a checkbox whose id are day_1, day_2......day_7 depending on different names of days sunday monday respectively. And below that each day has different Auctions when i click on any check box of any day then all check boxes of this will has been checked.

 

This action will be performed on check on checkbox. Now i want when I load this page then today checkboxes will be checked for each day

 

So when i use this code No action will be performed on onload of the page.

 

 

document.getElementById('day_6').checked = true;

CheckAll(document.getElementsByName('day6[]'));

 

 

function CheckAll(chk)

{

for (i = 0; i < chk.length; i++)

chk.checked = true ;

}

 

But the same code is giving the Correct result when i call these functions on onclick of the button

 

Why it is not giving the correct result on calling fuction on onload

and

Why it is giving the correct result on calling function on onclick

 

Please Help me

 

Thanks And Regards

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.