日期选择器
<%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) {
if (YearNo%100!=0 (YearNo%100==0 && YearNo%400==0)){
return true;
}
else {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){
if (IsRunY(YearNo)){return 29;}
else {return 28;}
}
}
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[i]+"-";
}
*/
function OutPut(YearNo, MonthNo){
var test="-"
var DayOut = new Array();
for (i=0; i<=41; i++){
DayOut[i]=0;
}
var n=0;
var row=0;
b=FirstDay(YearNo, MonthNo);
e=b+DaySum(YearNo, MonthNo)-1;
for (j=b; j<=e ; j++){
n=n+1;
DayOut[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 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[i]+")\">"+DayOut[i]+"</a></div></td>"
Ep_14_N="<td width=\"14%\" height=\"25\"><div align=\"center\"><A class=no href=\"javascript:ReturnDate("+DayOut[i]+")\">"+DayOut[i]+"</a></div></td>"
if (row>1 && DayOut[i]==0 &&(i+1)%7==1){break;}
if ((i+1)%7==1) {document.write ("<tr bgcolor=\"#fffff4\"> ");}
if ((i+1)%7==2 ((i+1)%7==1)){
if (DayOut[i]==0){
document.write (Is_Ep_15);
}
else{
if (DayOut[i]==GetToday()){ document.write (Ep_15_Y);}
else{document.write (Ep_15_N); }
}
}
else {
if (DayOut[i]==0){
document.write (Is_Ep_14);
}
else {
if (DayOut[i]==GetToday()){ document.write (Ep_14_Y);}
else{document.write (Ep_14_N); }
}
}
if ((i+1)%7==0) {
document.write ("</tr>");
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==""){
year_val = GetNowYear();
window.document.forms[0].y.value=GetNowYear(); }
else {
year_val = window.document.forms[0].y.value;
//window.document.forms[0].y.value=year_val;
}
if (month_val==""){
month_val= GetNowMonth();
window.document.forms[0].m.value=GetNowMonth();
}
else {
month_val=window.document.forms[0].m.value;
//window.document.forms[0].m.value=month_val;
}
//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%">
<div align="center"> <a href="javascript:Y_Minus()">-</a>
<input name="year_val" size="4" maxlength="4" value=<%=request("y")%>>
<a href="javascript:Y_Plus()">+</a> <span class="head_tab">年</span></div>
</td>
<td>
<div align="center"> <a href="javascript:M_Minus()">-</a>
<input name="month_val" size="2" maxlength="2" value=<%=request("m")%> >
<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==""){
window.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
fieldName = fieldName.toString();
//filename = filename.toString();
if (filename==''getdate.asp'') {
width_val=320;height_val=250;
}
else {
width_val=400;height_val=350;
}
//document.write (width_val);
if(fieldName.length != 0)
{
if (filename==''SoNo.asp''){
var pre;
pre = document.ga_form.from_prefix.value ;
filename = filename + "?rec=" +fieldName+"&pre="+pre;
}
else {
filename = filename + "?rec=" +fieldName;
}
}//if
WinFeature="width="+width_val+",height="+height_val+",statusbar=no,toolbar=no,resize=no,scrollbars=yes"
//alert(WinFeature);
OpenWin = window.open (filename,'''',WinFeature)
}
</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>
Tags:
作者:佚名评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论