人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

一個對于日期選擇的很實用的小東西

一個對于日期選擇的很實用的小東西

更新時間:2022-08-06 文章作者:未知 信息來源:網絡 閱讀次數:


以前做頁面時經常需要制作日期選擇框,例如出生日期、查詢日期等等,通常的做法是制作三個下拉列表(select),分別用于選擇年、月、日,但該方法在各方面的表現都很令人不耐煩,于是我做了這個日期選擇頁面,它不是組件,也不是函數,只是一個普通的ASP頁面,用于返回用戶選擇的日期變量。

************************************************************************

<%
'day.asp
%>
<html>
<head>
<title>選擇日期</title>
<style type=text/css>
<!--
body{margin:0;font-size:9pt;color:#5E639B}
td{font-size:9pt;color:#000000}
a:link {color:#000000;text-decoration: none}
a:visited {color:#000000;text-decoration: none}
a:active {color:#000000;text-decoration: none}
a:hover { color:#ff3333;text-decoration: none}
-->
</style>
<Script Language="JavaScript">
function getDay(v){
window.opener.document.<%=request.querystring("form")%>.<%=request.querystring("field")%>.value=v;
window.close();
return false;
}
</Script>
</head>
<body bgcolor=#ffffff onBlur="window.focus()">
<%
oldDate=request("oldDate")
if not isDate(oldDate) then oldDate=date
yy=year(cdate(oldDate))
mm=month(cdate(oldDate))
if request("yy")<>"" then yy=request("yy")
if request("mm")<>"" then mm=request("mm")
if yy="" then yy=year(date)
if mm="" then mm=month(date)
if mm>12 then mm=1:yy=yy+1
if mm<1 then mm=12:yy=yy-1

dim m(12)
m(1)=31
m(3)=31
m(5)=31
m(7)=31
m(8)=31
m(10)=31
m(12)=31
m(2)=28
m(4)=30
m(6)=30
m(9)=30
m(11)=30
if (yy mod 4=0 and yy mod 100<>0) or yy mod 400=0 then m(2)=29
mms=m(mm)
week1=(weekday(cdate(yy & "-" & mm & "-1"))-1)
%>
<table width=250 cellspacing=1 cellpadding=0 bgcolor=#FFDFDF align=center>
<tr>
<td colspan=7 align=center>
<table width=100% height=20 cellspacing=0 cellpadding=0>
<tr height=20>
<td width=30 align=center>
<a href=day.asp?form=<%=request("form")%>&field=<%=request("field")%>&yy=<%=(yy-1)%>&mm=<%=mm%>>
<font face=webdings style=color:#000000 title="上一年">7</font>
</a>
<td width=30 align=center>
<a href=day.asp?form=<%=request("form")%>&field=<%=request("field")%>&mm=<%=(mm-1)%>&yy=<%=yy%>>
<font face=webdings style=color:#000000 title="上一月">3</font>
</a>
<td width=130 align=center style="FONT:9pt Verdana,Geneva,sans-serif;color:#CD0101">
<b><%=yy%> 年 &nbsp; <%=mm%> 月</b>
<td width=30 align=center>
<a href=day.asp?form=<%=request("form")%>&field=<%=request("field")%>&mm=<%=(mm+1)%>&yy=<%=yy%>>
<font face=webdings style=color:#000000 title="下一月">4</font>
</a>
<td width=30 align=center>
<a href=day.asp?form=<%=request("form")%>&field=<%=request("field")%>&yy=<%=(yy+1)%>&mm=<%=mm%>>
<font face=webdings style=color:#000000 title="下一年">8</font>
</a>
</table>
<tr bgcolor=#ffffff height=20>
<td width=35 align=center bgcolor=#FFF4F4 style=color:#ff6633>日
<td width=35 align=center bgcolor=#FFF4F4>一
<td width=35 align=center bgcolor=#FFF4F4>二
<td width=35 align=center bgcolor=#FFF4F4>三
<td width=35 align=center bgcolor=#FFF4F4>四
<td width=35 align=center bgcolor=#FFF4F4>五
<td width=35 align=center bgcolor=#FFF4F4>六
<%
if week1<>0 then
response.write "<tr>"
for i=1 to week1
response.write "<td width=35 height=20 bgcolor=#ffffff>&nbsp;"
next
end if
for i=1 to mms
if (i+week1-1) mod 7=0 then response.write "<tr>"
response.write "<td width=35 height=20 align=center bgcolor=#ffffff>"
if cdate(yy & "-" & mm & "-" & i)=date() then
%>
<input type=button value=<%=i%>
style="BORDER:#CD0101 1px groove;width:30;height:16;font-size:9pt;background-color:#FFD9D9;color:#CD0101"
onclick="javascript:getDay('<%=yy%>-<%=mm%>-<%=i%>');" title="<%=yy%>年<%=mm%>月<%=i%>日(今天)">
<%
else
%>
<input type=button value=<%=i%>
style="BORDER:#000000 1px groove;width:30;height:16;font-size:9pt;background-color:#ffffff;color:#000000"
onclick="javascript:getDay('<%=yy%>-<%=mm%>-<%=i%>');" title="<%=yy%>年<%=mm%>月<%=i%>日">
<%
end if
next
if (mms+week1) mod 7<>0 then
for i=1 to (7-((mms+week1) mod 7))
response.write "<td width=35 height=20 bgcolor=#ffffff>&nbsp;"
next
end if
%>
</table><br>
<div align=center><a href="javascript:window.close()">〖關閉本窗口〗</a></div>
</body>
</html>

************************************************************************

調用day.asp頁面的代碼:

<form name=form1>
<input name=date1 value=<%=date()%> readonly onClick="javascript:window.open('day.asp?form=form1&field=date1&oldDate='+this.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=200,top=220,left=250');"
</form>

************************************************************************

其中,打開day.asp頁面時,需要傳遞幾個參數,分別是:

1)form:日期選擇框所在的表單名稱,本例為form1,可根據應用自行更改

2)field:日期選擇框的名稱,本例為date1,可根據應用自行更改

3)olddate:日期選擇框的當前值,不需改動。



我叫“積木”,歡迎和我成為朋友!

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 林口县| 福建省| 裕民县| 阿克陶县| 嫩江县| 临泉县| 铜鼓县| 孟津县| 英德市| 曲靖市| 东阳市| 昔阳县| 绵竹市| 和硕县| 新津县| 定兴县| 岳池县| 永安市| 清丰县| 毕节市| 韩城市| 武清区| 林口县| 南安市| 登封市| 莱阳市| 陆河县| 万年县| 新乡市| 克东县| 福州市| 岢岚县| 徐汇区| 敖汉旗| 白朗县| 宿迁市| 石嘴山市| 松潘县| 兴城市| 敦煌市| 德江县|