Jump to content

Recommended Posts

Dear Friends

 

I am using this code

 

function CheckAll(chk)

{

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

chk.checked = true ;

}

 

 

function show_now(){

var my_day=new Date()

//var dt = new Date(\"Aug 16, 2005 05:55:00\");

 

var day_name=new Array(7);

day_name[0]="Sunday"

day_name[1]="Monday"

day_name[2]="Tuesday"

day_name[3]="Wednesday"

day_name[4]="Thursday"

day_name[5]="Friday"

day_name[6]="Saturday"

 

day_name=day_name[my_day.getDay()];

 

 

if(day_name=="Sunday")

{

 

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

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

}

else if(day_name=="Monday")

{

 

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

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

}

else if(day_name=="Tuesday")

{

 

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

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

}

else if(day_name=="Wednesday")

{

 

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

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

}

else if(day_name=="Thursday")

{

 

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

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

}

else if(day_name=="Friday")

{

 

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

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

}

else if(day_name=="Saturday")

{

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

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

}

 

}

 

 

This code i am using for the checking of Check boxes according to day,

 

this code is perfectly working i called the Function "show_now()" on the onclick funtion but it is not working on the onload function, as i want to use that code on onload function.

 

i want that when i refresh the page the a series of checkbox which are according to the daywise has been selected according to today.

and this action has been perform when i refresh the page

 

so that is my problem when i use that code on the onclick it is working nicely but when i use it on onload it is not working which is my requirement.

 

for calling of function on Onload event i am using that code

 

<script language="javascript" type="text/javascript">

window.onLoad = show_now();

</script>

 

Kindly help me regarding this i will be very thankfull

 

 

Link to comment
https://forums.phpfreaks.com/topic/176379-checking-of-checkboxes/
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.