点击弹出日历框

a.asp代码:
<form method="POST" name="form1" autocomplete=off>
 <p align="center"><input type="text" name="T1" size="20" onClick="JavaScript:window.open('day.asp?form='+this.form.name+'&field='+this.name+'&oldDate='+this.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=200,top=220,left=250');">
 <input type="text" name="T2" size="20" οnclick="form1.T3.value=this.form.name;form1.T4.value=this.name;"><input type="text" name="T3" size="20" onClick="JavaScript:window.open('day.asp?form='+this.form.name+'&field='+this.name+'&oldDate='+this.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=200,top=220,left=250');"><input type="text" name="T4" size="20" onClick="JavaScript:window.open('day.asp?form='+this.form.name+'&field='+this.name+'&oldDate='+this.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=200,top=220,left=250');"><input type="submit" value="提交" name="B1"><input type="reset" value="重置" name="B2"></p>
</form>

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.opener.document.<%=request.querystring("form")%>.<%=request.querystring("field")%>.focus();
     window.opener=null;
     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"
 οnclick="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"
 οnclick="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>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值