<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> <script src="js/dateTimePicker.js" language="JavaScript" type="text/javascript" ></script> <%--<script src="js/WebCalendar.js" language="JavaScript" type="text/javascript" ></script>--%> <script type="text/javascript"> <!-- var timeout = 500; var closetimer = 0; var ddmenuitem = 0; // open hidden layer function mopen(id) { // cancel close timer mcancelclosetime(); // close old layer if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; // get new layer and show it ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } // close showed layer function mclose() { if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } // go close timer function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } // cancel close timer function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } // close layer when click-out document.onclick = mclose; // --> </script> <style type="text/css"> .btn { BORDER-RIGHT: #7b9ebd 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7b9ebd 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#cecfde); BORDER-LEFT: #7b9ebd 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #7b9ebd 1px solid } .btn1_mouseover { BORDER-RIGHT: #7EBF4F 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7EBF4F 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#CAE4B6); BORDER-LEFT: #7EBF4F 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #7EBF4F 1px solid } </style> <script type="text/javascript"> function displaySubMenu(li) { var subMenu = li.getElementsByTagName("ul")[0]; subMenu.style.display = "block"; } function hideSubMenu(li) { var subMenu = li.getElementsByTagName("ul")[0]; subMenu.style.display = "none"; } </script> <script type="text/javascript" language="javascript"> //获取系统时间 var LSTR_ndate=new Date(); var LSTR_Year=LSTR_ndate.getYear(); var LSTR_Month=LSTR_ndate.getMonth(); var LSTR_Date=LSTR_ndate.getDate(); var LSTR_Hours=LSTR_ndate.getHours(); var LSTR_Minutes=LSTR_ndate.getMinutes(); //处理 //beginuom 上月开始第一天 var beginuom = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); beginuom.setMonth(beginuom.getMonth()); beginuom.setDate(1); var beginuom_MM=beginuom.getMonth(); var beginuomLSTR_MM=beginuom_MM > 10?beginuom_MM:("0"+beginuom_MM) var beginuom_DD=beginuom.getDate(); var beginuomLSTR_DD=beginuom_DD > 10?beginuom_DD:("0"+beginuom_DD) beginuom = beginuom.getFullYear() + "-" +beginuomLSTR_MM+ "-"+beginuomLSTR_DD+" "+"00"+":"+"00"; //enduom上月开始最后一天 var enduom = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); enduom.setMonth(enduom.getMonth()); var enduom_MM=enduom.getMonth(); if(enduom_MM==1||enduom_MM==3||enduom_MM==5||enduom_MM==7||enduom_MM==8||enduom_MM==10||enduom_MM==12) { var enduom_DD=31; } else if(enduom_MM==4||enduom_MM==6||enduom_MM==9||enduom_MM==11) { var enduom_DD=30; } else if(enduom_MM==2) { var enduom_DD=28; } var enduomLSTR_MM=enduom_MM > 10?enduom_MM:("0"+enduom_MM) var enduomLSTR_DD=enduom_DD > 10?enduom_DD:("0"+enduom_DD) enduom = enduom.getFullYear() + "-" +enduomLSTR_MM+ "-"+enduomLSTR_DD+" "+"23"+":"+"59"; //begintodaymonth 获取本月第一天 var begintodaymonth = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); begintodaymonth.setDate(1); var begintodaymonth_MM=begintodaymonth.getMonth(); begintodaymonth_MM++; var begintodaymonthLSTR_MM=begintodaymonth_MM > 10?begintodaymonth_MM:("0"+begintodaymonth_MM) var begintodaymonth_DD=begintodaymonth.getDate(); var begintodaymonthLSTR_DD=begintodaymonth_DD > 10?begintodaymonth_DD:("0"+begintodaymonth_DD) begintodaymonth = begintodaymonth.getFullYear() + "-" +begintodaymonthLSTR_MM+ "-"+begintodaymonthLSTR_DD+" "+"00"+":"+"00"; //endtodaymonth本月 var endtodaymonth = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); endtodaymonth.setMinutes(endtodaymonth.getMinutes()+1); var endtodaymonth_MM=endtodaymonth.getMonth(); endtodaymonth_MM++; var endtodaymonthLSTR_MM=endtodaymonth_MM > 10?endtodaymonth_MM:("0"+endtodaymonth_MM) var endtodaymonth_DD=endtodaymonth.getDate(); var endtodaymonthLSTR_DD=endtodaymonth_DD > 10?endtodaymonth_DD:("0"+endtodaymonth_DD) endtodaymonth = endtodaymonth.getFullYear() + "-" +endtodaymonthLSTR_MM+ "-"+endtodaymonthLSTR_DD+" "+chekTime(endtodaymonth.getHours())+":"+chekTime(endtodaymonth.getMinutes()); // beginweek 上周第一天 var beginweek = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); beginweek.setDate(beginweek.getDate()-(beginweek.getDay()-1)-7*1); var beginweek_MM=beginweek.getMonth(); beginweek_MM++; var beginweekLSTR_MM=beginweek_MM > 10?beginweek_MM:("0"+beginweek_MM) var beginweek_DD=beginweek.getDate(); var beginweekLSTR_DD=beginweek_DD > 10?beginweek_DD:("0"+beginweek_DD) beginweek = beginweek.getFullYear() + "-" +beginweekLSTR_MM+ "-"+beginweekLSTR_DD+" "+"00"+":"+"00"; //endweek上周最后一天 var endweek = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); endweek.setDate(endweek.getDate()-(endweek.getDay()-1)-1*1); var endweek_MM=endweek.getMonth(); endweek_MM++; var endweekLSTR_MM=endweek_MM > 10?endweek_MM:("0"+endweek_MM) var endweek_DD=endweek.getDate(); var endweekLSTR_DD=endweek_DD > 10?endweek_DD:("0"+endweek_DD) endweek = endweek.getFullYear() + "-" +endweekLSTR_MM+ "-"+endweekLSTR_DD+" "+"23"+":"+"59"; //begintodayweek本周第一天 var begintodayweek = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); begintodayweek.setDate(begintodayweek.getDate()-(begintodayweek.getDay()-1)); var begintodayweek_MM=begintodayweek.getMonth(); begintodayweek_MM++; var begintodayweekLSTR_MM=begintodayweek_MM > 10?begintodayweek_MM:("0"+begintodayweek_MM) var begintodayweek_DD=begintodayweek.getDate(); var begintodayweekLSTR_DD=endweek_DD > 10?begintodayweek_DD:("0"+begintodayweek_DD) begintodayweek = begintodayweek.getFullYear() + "-" +begintodayweekLSTR_MM+ "-"+begintodayweekLSTR_DD+" "+"00"+":"+"00"; //endtodayweek本周当天 var endtodayweek = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); endtodayweek.setMinutes(endtodayweek.getMinutes()+1); var endtodayweek_MM=endtodayweek.getMonth(); endtodayweek_MM++; var endtodayweekLSTR_MM=endtodayweek_MM > 10?endtodayweek_MM:("0"+endtodayweek_MM) var endtodayweek_DD=endtodayweek.getDate(); var endtodayweekLSTR_DD=endtodayweek_DD > 10?endtodayweek_DD:("0"+endtodayweek_DD) endtodayweek = endtodayweek.getFullYear() + "-" +endtodayweekLSTR_MM+ "-"+endtodayweekLSTR_DD+" "+chekTime(endtodayweek.getHours())+":"+chekTime(endtodayweek.getMinutes()); //beginyestoday 昨天的开始时间 var beginyestoday = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); beginyestoday.setDate(beginyestoday.getDate()-1); var beginyestoday_MM=beginyestoday.getMonth(); beginyestoday_MM++; var beginyestodayLSTR_MM=beginyestoday_MM > 10?beginyestoday_MM:("0"+beginyestoday_MM) var beginyestoday_DD=beginyestoday.getDate(); var beginyestodayLSTR_DD=beginyestoday_DD > 10?beginyestoday_DD:("0"+beginyestoday_DD) beginyestoday = beginyestoday.getFullYear() + "-" +beginyestodayLSTR_MM+ "-"+beginyestodayLSTR_DD+" "+"00"+":"+"00"; //endyestoday昨天的结束时间 var endyestoday = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); endyestoday.setDate(endyestoday.getDate()-1); var endyestoday_MM=endyestoday.getMonth(); endyestoday_MM++; var endyestodayLSTR_MM=endyestoday_MM > 10?endyestoday_MM:("0"+endyestoday_MM) var endyestoday_DD=endyestoday.getDate(); var endyestodayLSTR_DD=endyestoday_DD > 10?endyestoday_DD:("0"+endyestoday_DD) endyestoday = endyestoday.getFullYear() + "-" +endyestodayLSTR_MM+ "-"+endyestodayLSTR_DD+" "+"23"+":"+"59"; //begintoday的开始时间 var begintoday = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); var begintoday_MM=begintoday.getMonth(); begintoday_MM++; var begintodayLSTR_MM=begintoday_MM > 10?begintoday_MM:("0"+begintoday_MM) var begintoday_DD=begintoday.getDate(); var begintodayLSTR_DD=begintoday_DD > 10?begintoday_DD:("0"+begintoday_DD) begintoday = begintoday.getFullYear() + "-" +begintodayLSTR_MM+ "-"+begintodayLSTR_DD+" "+"00"+":"+"00"; //endtoday今天的当前时间 var endtoday = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); endtoday.setMinutes(endtoday.getMinutes()+1); var endtoday_MM=endtoday.getMonth(); endtoday_MM++; var endtodayLSTR_MM=endtoday_MM > 10?endtoday_MM:("0"+endtoday_MM) var endtoday_DD=endtoday.getDate(); var endtodayLSTR_DD=endtoday_DD > 10?endtoday_DD:("0"+endtoday_DD) endtoday = endtoday.getFullYear() + "-" +endtodayLSTR_MM+ "-"+endtodayLSTR_DD+" "+chekTime(endtoday.getHours())+":"+chekTime(endtoday.getMinutes()); //beginwork本班次的开始时间 var beginwork = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); var beginwork_MM=beginwork.getMonth(); beginwork_MM++; var beginworkLSTR_MM=beginwork_MM > 10?beginwork_MM:("0"+beginwork_MM) var beginwork_DD=beginwork.getDate(); var beginworkLSTR_DD=beginwork_DD > 10?beginwork_DD:("0"+beginwork_DD) beginwork = beginwork.getFullYear() + "-" +beginworkLSTR_MM+ "-"+beginworkLSTR_DD+" "+"00"+":"+"00"; //endwork本班次的结束时间 function chekTime(i) { if (i<10) {i="0" + i} return i } var endwork = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); endwork.setMinutes(endwork.getMinutes()+1); var endwork_MM=endwork.getMonth(); endwork_MM++; var endworkLSTR_MM=endwork_MM > 10?endwork_MM:("0"+endwork_MM) var endwork_DD=endwork.getDate(); var endworkLSTR_DD=endwork_DD > 10?endwork_DD:("0"+endwork_DD) endwork = endwork.getFullYear() + "-" +endworkLSTR_MM+ "-"+endworkLSTR_DD+" "+chekTime(endwork.getHours())+":"+chekTime(endwork.getMinutes()); var uom = new Date(LSTR_Year,LSTR_Month,LSTR_Date,LSTR_Hours,LSTR_Minutes); //uom.setDate(uom.getDate()-(uom.getDay()-1)-7*1);//取得系统时间的前一天,重点在这里,负数是前几天,正数是后几天 //uom.setDate(1);//取得系统时间的前一天,重点在这里,负数是前几天,正数是后几天 //var LINT_MM=uom.getMonth(); //LINT_MM++; uom.setMonth(uom.getMonth()); var LINT_MM=uom.getMonth(); if(LINT_MM==1||LINT_MM==3||LINT_MM==5||LINT_MM==7||LINT_MM==8||LINT_MM==10||LINT_MM==12) { var LINT_DD=31; } else if(LINT_MM==4||LINT_MM==6||LINT_MM==9||LINT_MM==11) { var LINT_DD=30; } else if(LINT_MM==2) { var LINT_DD=28; } var LSTR_MM=LINT_MM > 10?LINT_MM:("0"+LINT_MM) //var LINT_DD=uom.getDate(); var LSTR_DD=LINT_DD > 10?LINT_DD:("0"+LINT_DD) //得到最终结果 //uom = uom.getFullYear() + "-0" + uom.getMonth() + "-"+LSTR_DD+" "+"00"+":"+"05"; uom = uom.getFullYear() + "-" +LSTR_MM+ "-"+LSTR_DD+" "+"00"+":"+"05"; function show() { } //上月 function beginuomshow() { document.getElementById("txt_one").value=beginuom; document.getElementById("txt_two").value=enduom; } //本月 function begintodaymonthshow() { document.getElementById("txt_one").value=begintodaymonth; document.getElementById("txt_two").value=endtodaymonth; } //上周 function beginweekshow() { document.getElementById("txt_one").value=beginweek; document.getElementById("txt_two").value=endweek; } //本周 function begintodayweekshow() { document.getElementById("txt_one").value=begintodayweek; document.getElementById("txt_two").value=endtodayweek; } //昨天 function beginyestodayshow() { document.getElementById("txt_one").value=beginyestoday; document.getElementById("txt_two").value=endyestoday; } //今天 function begintodayshow() { document.getElementById("txt_one").value=begintoday; document.getElementById("txt_two").value=endtoday; } //本班次 function beginworkshow() { document.getElementById("txt_one").value=beginwork; document.getElementById("txt_two").value=endwork; } function showtxt() { } </script> <script type="text/javascript"> var d=new Date() d.setMonth(0) //document.write(d) </script> </head> <body> <form id="form1" runat="server"> <div> <%-- <asp:TextBox ID="TextBoxOverDueTime" runat="server" OnClick="setday(this)" ></asp:TextBox>--%> <asp:Button CssClass="btn1_mouseover" onmouseover="mopen('content')" onmouseout="mclosetime()" ID="type" runat="server" Text="请选择时间段" Width="85px" /> 从<input type="text" runat="server" id="txt_one" onclick="new Calendar().show(this);" value="" style=" 100px" /> 至<input type="text" runat="server" id="txt_two" onclick="new Calendar().show(this);" value="" style=" 100px"/> <div id="content" onmouseover="mcancelclosetime()" onmouseout="mclosetime()" style=" visibility:hidden;"> <asp:Panel ID="Panel1" runat="server" Height="162px" Width="76px" CssClass="btn"> <input id="Button1" type="button" value="a" Class="btn" onmouseover='this.className="btn1_mouseover"' onmouseout='this.className="btn"' onclick="return beginworkshow();" style=" 76px"/> <input id="Button2" type="button" value="b" Class="btn" onmouseover='this.className="btn1_mouseover"' onmouseout='this.className="btn"' onclick="return begintodayshow();" style=" 76px"/> <input id="Button3" type="button" value="c" Class="btn" onmouseover='this.className="btn1_mouseover"' onmouseout='this.className="btn"' onclick="return beginyestodayshow();" style=" 76px"/> <input id="Button4" type="button" value="d" Class="btn" onmouseover='this.className="btn1_mouseover"' onmouseout='this.className="btn"' onclick="return beginuomshow();" style=" 76px"/> <input id="Button5" type="button" value="e" Class="btn" onmouseover='this.className="btn1_mouseover"' onmouseout='this.className="btn"' onclick="return begintodayweekshow();" style=" 76px"/> <input id="Button6" type="button" value="f" Class="btn" onmouseover='this.className="btn1_mouseover"' onmouseout='this.className="btn"' onclick="return beginweekshow();" style=" 76px"/> <input id="Button7" type="button" value="g" Class="btn" onmouseover='this.className="btn1_mouseover"' onmouseout='this.className="btn"' onclick="return begintodaymonthshow();" style=" 76px"/> <input id="Button8" type="button" value="h" Class="btn" onmouseover='this.className="btn1_mouseover"' onmouseout='this.className="btn"' onclick="return beginuomshow();" style=" 76px"/> </asp:Panel> </div> </div> </form> </body> </html>