https://www.jmqz1000.com

日期选择器

''file name /getDate.asp/

<%rec=Request("rec")%>
<HTML>
<HEAD>

<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<style type="text/css">
<!--
.head_tab { font-family: "Times New Roman", "Times", "serif"; font-size: 10pt; color: #9999FF; font-weight: bold}
.no { font-size: 12pt; color: #CCCCFF; text-decoration: none}
a:hover { font-size: 9pt; color: #6666FF; text-decoration: none; font-weight: bold}
a:link { text-decoration: none; font-size: 12pt; color: #CCCCFF}
-->
</style>
<script language="javascript">

var YearNo, MonthNo, DayNo

function IsRunY(YearNo)
{
if (YearNo%4==0) {
\tif (YearNo%100!=0 || (YearNo%100==0 && YearNo%400==0)){
\t return true;
\t}
\telse {return false;}
}
else {return false;}
}

function DaySum(YearNo, MonthNo){
if(MonthNo==1 || MonthNo==3 || MonthNo==5 || MonthNo==7 || MonthNo==8 || MonthNo==10 || MonthNo==12){return 31;}
if (MonthNo==4 || MonthNo==6 || MonthNo==9 || MonthNo==11 ) {return 30;}
if (MonthNo==2){
\tif (IsRunY(YearNo)){return 29;}
\telse {return 28;}
}
}\t

function FirstDay(YearNo, MonthNo){
var DayVal=new Date(YearNo+"/"+MonthNo+"/01");
FirstDay=DayVal.getDay();
return (FirstDay);
}
function GetToday(){
var DayVal=new Date();
return DayVal.getDate();
}
function GetNowMonth(){
var DayVal=new Date();
return (DayVal.getMonth()+1);
}
function GetNowYear(){
var DayVal=new Date();
return DayVal.getYear();
}
/*
for (i=0; i<=41; i++){
test=test+DayOut+"-";
}
*/
function OutPut(YearNo, MonthNo){
var test="-"
var DayOut = new Array();
for (i=0; i<=41; i++){
\tDayOut=0;
}

var n=0;
var row=0;
b=FirstDay(YearNo, MonthNo);
e=b+DaySum(YearNo, MonthNo)-1;
for (j=b; j<=e ; j++){
\tn=n+1;
\tDayOut[j]=n;
}

Is_Ep_15="<td width=\"15%\" height=\"25\"><div align=\"center\"> </div></td>"
Is_Ep_14="<td width=\"14%\" height=\"25\"><div align=\"center\"> </div></td>"
Ep_15_Y="<td width=\"15%\" height=\"25\"><div align=\"center\"><A html' target='_blank'>class=no style=\"COLOR: #33ff33\" href=\"javascript:ReturnDate("+GetToday()+")\">"+GetToday()+"</a></div></td>"
Ep_14_Y="<td width=\"14%\" height=\"25\"><div align=\"center\"><A class=no style=\"COLOR: #33ff33\" href=\"javascript:ReturnDate("+GetToday()+")\">"+GetToday()+"</a></div></td>"
for (i=0; i<=41; i++){
Ep_15_N="<td width=\"15%\" height=\"25\"><div align=\"center\"><A class=no href=\"javascript:ReturnDate("+DayOut+")\">"+DayOut+"</a></div></td>"
Ep_14_N="<td width=\"14%\" height=\"25\"><div align=\"center\"><A class=no href=\"javascript:ReturnDate("+DayOut+")\">"+DayOut+"</a></div></td>"

if (row>1 && DayOut==0 &&(i+1)%7==1){break;}
\tif ((i+1)%7==1) {document.write ("<tr bgcolor=\"#fffff4\"> ");}
\tif ((i+1)%7==2 || ((i+1)%7==1)){
\t if (DayOut==0){
\t\tdocument.write (Is_Ep_15);
\t\t}
\t else{
\t\tif (DayOut==GetToday()){ document.write (Ep_15_Y);}
\t\telse{document.write (Ep_15_N); }
\t\t}
\t }
\telse {
\t if (DayOut==0){
\t\tdocument.write (Is_Ep_14);
\t\t}
\t else {
\t\tif (DayOut==GetToday()){ document.write (Ep_14_Y);}
\t\telse{document.write (Ep_14_N); }
\t\t}
\t }
\t
\tif ((i+1)%7==0) {
\t document.write ("</tr>");
\t row=row+1;}
}
}

function Y_Plus(){
window.document.forms[0].y.value=parseInt(window.document.forms[0].y.value)+1;
if (window.document.forms[0].y.value==2021){window.document.forms[0].y.value=1970;}
self.document.form1.submit();
}
function M_Plus(){
window.document.forms[0].m.value=parseInt(window.document.forms[0].m.value)+1;
if (window.document.forms[0].m.value==13){window.document.forms[0].m.value=1;}
self.document.form1.submit();
}
function Y_Minus(){
window.document.forms[0].y.value=parseInt(window.document.forms[0].y.value)-1;
if (window.document.forms[0].y.value==1969){window.document.forms[0].y.value=2020;}
self.document.form1.submit();
}
function M_Minus(){
window.document.forms[0].m.value=parseInt(window.document.forms[0].m.value)-1;
if (window.document.forms[0].m.value==0){window.document.forms[0].m.value=12;}
self.document.form1.submit();
}


function ReturnDate(val){
//RtDay=val;
RtDay=val.toString();
RtMonth=window.document.forms[0].m.value.toString();
RtYear=window.document.forms[0].y.value.toString();
if (RtDay.length==1) {RtDay="0"+RtDay;}
if (RtMonth.length==1){RtMonth="0"+RtMonth;}

RtStr=RtDay+"/"+RtMonth+"/"+RtYear;

window.opener.document.forms[0].<%= rec%>.value = RtStr;
window.close();
//alert(RtStr);

}
//alert(FirstDay(2000,02));

//alert(IsRunY(1989));

//alert(DaySum(2000,2));

//alert(test(1,5));

//alert(test(2000,3))

</script>
</HEAD>

<body bgcolor="#ffffff">
<form action="#" method="post" name="form1">
<input type="hidden" name="y" value=<%=Request("y")%>>
<input type="hidden" name="m" value=<%=request("m")%>>
<span class="no"></span>

<table width="280" cellspacing="0" cellpadding="0" align="center" class="no" bordercolorlight="#ffffff" bordercolordark="#000000" bordercolor="#ccffff" border="1">
<tr bgcolor="#e8fdfb">
<td height="25">
<div align="center"><font color="#ffffff" class="head_tab">Sun</font></div>
</td>
<td height="25" width="15%">
<div align="center"><font color="#ffffff" class="head_tab">Mon</font></div>
</td>
<td height="25" width="14%">
<div align="center"><font color="#ffffff" class="head_tab">Tue</font></div>
</td>
<td height="25" width="14%">
<div align="center"><font color="#ffffff" class="head_tab">Wen</font></div>
</td>
<td height="25" width="14%">
<div align="center"><font color="#ffffff" class="head_tab">Thu</font></div>
</td>
<td height="25" width="14%">
<div align="center"><font color="#ffffff" class="head_tab">Fri</font></div>
</td>
<td height="25" width="14%">
<div align="center"><font color="#ffffff" class="head_tab">Sat</font></div>
</td>
</tr>
<script language="javascript">

year_val = window.document.forms[0].y.value;
month_val = window.document.forms[0].m.value;
//alert(year_val);
//d = new Date();
if (year_val==""){
\tyear_val = GetNowYear();
\twindow.document.forms[0].y.value=GetNowYear(); }
else {
\tyear_val = window.document.forms[0].y.value;
\t//window.document.forms[0].y.value=year_val;
\t}
if (month_val==""){
\tmonth_val= GetNowMonth();
\twindow.document.forms[0].m.value=GetNowMonth();
\t}
else {
\tmonth_val=window.document.forms[0].m.value;
\t//window.document.forms[0].m.value=month_val;
}
\t
//alert(year_val+","+month_val);
OutPut(year_val,month_val);
</script>

</table>
<span class="head_tab"></span>
<div align="center" class="no">
<table width="280" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="50%">
\t<div align="center"> <a href="javascript:Y_Minus()">-</a>
\t <input name="year_val" size="4" maxlength="4" value=<%=request("y")%>>
\t <a href="javascript:Y_Plus()">+</a> <span class="head_tab">年</span></div>
</td>
<td>
\t<div align="center"> <a href="javascript:M_Minus()">-</a>
\t <input name="month_val" size="2" maxlength="2" value=<%=request("m")%> >
\t <a href="javascript:M_Plus()">+</a> <span class="head_tab">月</span></div>
</td>
</tr>
</table>

<span class="no"></span> </div>
<script language="javascript">
if (window.document.forms[0].year_val.value==""){
\t
\twindow.document.forms[0].year_val.value=GetNowYear(); }
if (window.document.forms[0].month_val.value==""){
window.document.forms[0].month_val.value=GetNowMonth();}

</script>
</form>
</body>
</HTML>

''file name /test.asp/

<%@ Language=VBScript %>
<HTML>
<HEAD>
<script language="javascript">
function OpenNewWin(filename, fieldName)
{
var width_val, height_val, fieldName, filename, WinFeature
\tfieldName = fieldName.toString();
\t//filename = filename.toString();
\tif (filename==''getdate.asp'') {
\t width_val=320;height_val=250;
\t }
\t else {
\t\twidth_val=400;height_val=350;
\t}
\t//document.write (width_val);
\t
\tif(fieldName.length != 0)
\t{
\t if (filename==''SoNo.asp''){
\t\tvar pre;
\t\tpre = document.ga_form.from_prefix.value ;
\t\tfilename = filename + "?rec=" +fieldName+"&pre="+pre;
\t }
\t else {
\t\tfilename = filename + "?rec=" +fieldName;
\t }\t
\t}//if
\tWinFeature="width="+width_val+",height="+height_val+",statusbar=no,toolbar=no,resize=no,scrollbars=yes"
\t//alert(WinFeature);
\tOpenWin = window.open (filename,'''',WinFeature)
\t
}
</script>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<form action="" method="post">
<INPUT type="text" id=text1 name=''from_date'' ><A href="javascript:OpenNewWin(''getdate.asp'',''from_date'');">getDate</a>
<P> </P>
</form>
</BODY>
</HTML>

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。

相关文章阅读