<!DOCTYPE html>
<HtmlLang= "en"xmlns= "Http://www.w3.org/1999/xhtml">
<Head>
<MetaCharSet= "Utf-8"/>
<Title></Title>
<ScriptSrc=".. /js/jquery-1.8.2.js "></Script>
<ScriptType= "Text/javascript">
$(function() {Obaganlestyle (1,7);
});
functionObaganlestyle (Snum,lnum)
{
VarMyDate=NewDate ();
VarDay=Mydate.getday ();//Returns 0-6
//var today = new Array (' Sunday ', ' Monday ', ' Tuesday ', ' Wednesday ', ' Thursday ', ' Friday ', ' Saturday ');
//Date of the day
VarEndday;
VarStartDay;
Endday=Getthisday (-Day+Lnum);//Sunday
StartDay=Getthisday (-Day+Snum);//Count of Monday
$("#begintime"). Val (startday+"00:00:00");
$("#endtime"). Val (endday+"59:59:59");
}
//Date obtained
functionGetthisday (Day) {
VarToday=NewDate ();
VarTargetday_milliseconds=Today.gettime ()+1000*60*60*24*Day
Today.settime (Targetday_milliseconds);//The essential
VarTyear=Today.getfullyear ();
VarTmonth=Today.getmonth ();
VarTdate=Today.getdate ();
If(tdate<10) {
Tdate="0"+Tdate;
}
Tmonth=Tmonth+1;
If(Tmonth<10) {
Tmonth="0"+Tmonth;
}
ReturnTyear+"-"+Tmonth+"-"+Tdate+"";
}
//Various dates obtained
functionGetdaybytype (type) {
Switch(type) {
Case1:
Obaganlestyle (1,7);
Break;
Case2:
Obaganlestyle (0,-6);
Break;
Case3:
Obaganlestyle (8,14);
Break;
Default:
Break;
}
}
</Script>
</Head>
<Body>
Start time:<InputType= "Text"Id= "BeginTime"Value=""/><Br/>
End Time:<InputType= "Text"Id= "Endtime"Value="">
<InputType= "button"Id= "ThisWeek"OnClick= "Getdaybytype (1)"Value= "This Week"/>
<InputType= "button"Id= "Onweek" Onclick=" Getdaybytype (2) " Value/>
<input type= "button" Id= "Nextweek" Onclick= "Getdaybytype (3)" Value= "Next week" />
</body>
Span style= "color: #0000ff;" ></html>
jquery gets this week, last week, next week of Monday and Sunday