⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectmonth.asp

📁 ASPTest 网络基础网页设计
💻 ASP
字号:
<% 
Dim i,month1,month2,month3,year1,year2,year3
Dim TempDate1,TempDate2,TempDate3

'如果是第一次查询,就取当前日期前一天、前两天、前三天作为默认时间
If Session("mYear1") = "" Then

  TempDate1 = DateAdd("m",-1,Date)
  TempDate2 = DateAdd("m",-2,Date)
  TempDate3 = DateAdd("m",-3,Date)
  month1 = Month(TempDate1)
  month2 = Month(TempDate2)
  month3 = Month(TempDate3)
  year1 = Year(TempDate1)
  year2 = Year(TempDate2)
  year3 = Year(TempDate3)
  
Else '如果不是第一次查询,则取上一次选择的日期为默认日期

  month1 = CInt(Session("mMonth1"))
  month2 = CInt(Session("mMonth2"))
  month3 = CInt(Session("mMonth3"))
  year1 = CInt(Session("mYear1"))
  year2 = CInt(Session("mYear2"))
  year3 = CInt(Session("mYear3"))

End If
%>

<form method="POST" action="MonthPower.asp" target="Bottom">
<table border="0" cellpadding="0" cellspacing="0" width="527" align="center">
  <tr>
    <td width="260" align="center" height="30">第一个月份:
      <select size="1" name="mYear1">
        <% 
        For i = 2000 to 2010
          If i = year1 Then
            Response.Write "<option selected>"&i&"</option>"
          Else
            Response.Write "<option>"&i&"</option>"
          End If
        Next
        %>
      </select>年
      <select size="1" name="mMonth1">
        <% 
        For i = 1 to 12
          If i = month1 Then
            Response.Write "<option selected>"&i&"</option>"
          Else
            Response.Write "<option>"&i&"</option>"
          End If
        Next
        %>
      </select>月</td>
    <td width="267" height="30" align="right">第二个月份:
      <select size="1" name="mYear2">
        <% 
        For i = 2000 to 2010
          If i = year2 Then
            Response.Write "<option selected>"&i&"</option>"
          Else
            Response.Write "<option>"&i&"</option>"
          End If
        Next
        %>
      </select>年
      <select size="1" name="mMonth2">
        <% 
        For i = 1 to 12
          If i = month2 Then
            Response.Write "<option selected>"&i&"</option>"
          Else
            Response.Write "<option>"&i&"</option>"
          End If
        Next
        %>
      </select>月
    </td>
  </tr>
  <tr>
    <td width="260" align="center" height="30">第三个月份:
      <select size="1" name="mYear3">
        <% 
        For i = 2000 to 2010
          If i = year3 Then
            Response.Write "<option selected>"&i&"</option>"
          Else
            Response.Write "<option>"&i&"</option>"
          End If
        Next
        %>
      </select>年
      <select size="1" name="mMonth3">
        <% 
        For i = 1 to 12
          If i = month3 Then
            Response.Write "<option selected>"&i&"</option>"
          Else
            Response.Write "<option>"&i&"</option>"
          End If
        Next
        %>
      </select>月 
    </td>
    <td width="267" align="right" height="30">
      <input type="submit" value="确认查询" name="B1">&nbsp; 
      <input type="reset" value="重置日期" name="B2">
    </td>
  </tr>
</table>
<input type="hidden" name="type" value="<%=Session("rtype")%>"></input>
<input type="hidden" name="name" value="<%=Session("rname")%>"></input>
</form>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -