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
On Body OnLoad Function the, The Checkboxes Never Checked
Moderator: General Moderators
-
habib009pk
- Forum Commoner
- Posts: 43
- Joined: Sun Jul 05, 2009 11:28 pm
-
maneetpuri
- Forum Commoner
- Posts: 60
- Joined: Tue Oct 07, 2008 6:32 am
Re: On Body OnLoad Function the, The Checkboxes Never Checked
Hi,
This is strange,
Try this - do not call the function on onload, instead write a small javascript that gives the call to this function and put this as the last lines of your page just above the </body> tag.
Let’s see if this works.
Cheers,
~Maneet
This is strange,
Try this - do not call the function on onload, instead write a small javascript that gives the call to this function and put this as the last lines of your page just above the </body> tag.
Let’s see if this works.
Cheers,
~Maneet
Re: On Body OnLoad Function the, The Checkboxes Never Checked
It should be chk.checked = true ;