列表框onchange或onblur事件里面作判断

解决方案 »

  1.   

    <script language="JavaScript">function select(){
    var w,j,m;
    switch (document.form1.month.value){
    case "1":
    w=31;
    break;
    case "2":
    w=28;
    break;
    case "3":
    w=31;
    break;
    case "4":
    w=30;
    break;
    case "5":
    w=31;
    break;
    case "6":
    w=30;
    break;
    case "7":
    w=31;
    break;
    case "8":
    w=31;
    break;
    case "9":
    w=30;
    break;
    case "10":
    w=31;
    break;
    case "11":
    w=30;
    break;
    case "12":
    w=31;
    break;
    }
    document.form1.day.options.length=w;
    for (var i=0;i<w;i++){
    j=i+1;
    m=j;
    if (j<10){
    j="0"+j;
    }
    document.form1.day.options[i].value=j;
    document.form1.day.options[i].text=m;
    }
    }
    </script>
      

  2.   

    <select name="year">
                <option value="1999"<%if year(date())="1999" then response.write "selected"%>><font color="#000000">1999</font></option>
                <option value="2000"<%if year(date())="2000" then response.write "selected"%>><font color="#000000">2000</font></option>
                <option value="2001"<%if year(date())="2001" then response.write "selected"%>><font color="#000000">2001</font></option>
                <option value="2002"<%if year(date())="2002" then response.write "selected"%>><font color="#000000">2002</font></option>
                <option value="2003"<%if year(date())="2003" then response.write "selected"%>><font color="#000000">2003</font></option>
                <option value="2004"<%if year(date())="2004" then response.write "selected"%>><font color="#000000">2004</font></option>
                <option value="2005"<%if year(date())="2005" then response.write "selected"%>><font color="#000000">2005</font></option>
                <option value="2006"<%if year(date())="2006" then response.write "selected"%>><font color="#000000">2006</font></option>
                <option value="2007"<%if year(date())="2007" then response.write "selected"%>><font color="#000000">2007</font></option>
                <option value="2008"<%if year(date())="2008" then response.write "selected"%>><font color="#000000">2008</font></option>
                <option value="2009"<%if year(date())="2009" then response.write "selected"%>><font color="#000000">2009</font></option>
                <option value="2010"<%if year(date())="2010" then response.write "selected"%>><font color="#000000">2010</font></option>
                <option value="2011"<%if year(date())="2011" then response.write "selected"%>><font color="#000000">2011</font></option>
                <option value="2012"<%if year(date())="2012" then response.write "selected"%>><font color="#000000">2012</font></option>
                <option value="2013"<%if year(date())="2013" then response.write "selected"%>><font color="#000000">2013</font></option>
                <option value="2014"<%if year(date())="2014" then response.write "selected"%>><font color="#000000">2014</font></option>
                <option value="2015"<%if year(date())="2015" then response.write "selected"%>><font color="#000000">2015</font></option>
              </select>
              年 
              <select name="month" onChange=select()>
                <option value="1"<%if month(date())="1" then response.write "selected"%>><font color="#000000">1</font></option>
                <option value="2"<%if month(date())="2" then response.write "selected"%>><font color="#000000">2</font></option>
                <option value="3"<%if month(date())="3" then response.write "selected"%>><font color="#000000">3</font></option>
                <option value="4"<%if month(date())="4" then response.write "selected"%>><font color="#000000">4</font></option>
                <option value="5"<%if month(date())="5" then response.write "selected"%>><font color="#000000">5</font></option>
                <option value="6"<%if month(date())="6" then response.write "selected"%>><font color="#000000">6</font></option>
                <option value="7"<%if month(date())="7" then response.write "selected"%>><font color="#000000">7</font></option>
                <option value="8"<%if month(date())="8" then response.write "selected"%>><font color="#000000">8</font></option>
                <option value="9"<%if month(date())="9" then response.write "selected"%>><font color="#000000">9</font></option>
                <option value="10"<%if month(date())="10" then response.write "selected"%>><font color="#000000">10</font></option>
                <option value="11"<%if month(date())="11" then response.write "selected"%>><font color="#000000">11</font></option>
                <option value="12"<%if month(date())="12" then response.write "selected"%>><font color="#000000">12</font></option>
              </select>
              月 
              <select name="day">
                <option value="1"<%if day(date())="1" then response.write "selected"%>><font color="#000000">1</font></option>
                <option value="2"<%if day(date())="2" then response.write "selected"%>><font color="#000000">2</font></option>
                <option value="3"<%if day(date())="3" then response.write "selected"%>><font color="#000000">3</font></option>
                <option value="4"<%if day(date())="4" then response.write "selected"%>><font color="#000000">4</font></option>
                <option value="5"<%if day(date())="5" then response.write "selected"%>><font color="#000000">5</font></option>
                <option value="6"<%if day(date())="6" then response.write "selected"%>><font color="#000000">6</font></option>
                <option value="7"<%if day(date())="7" then response.write "selected"%>><font color="#000000">7</font></option>
                <option value="8"<%if day(date())="8" then response.write "selected"%>><font color="#000000">8</font></option>
                <option value="9"<%if day(date())="9" then response.write "selected"%>><font color="#000000">9</font></option>
                <option value="10"<%if day(date())="10" then response.write "selected"%>><font color="#000000">10</font></option>
                <option value="11"<%if day(date())="11" then response.write "selected"%>><font color="#000000">11</font></option>
                <option value="12"<%if day(date())="12" then response.write "selected"%>><font color="#000000">12</font></option>
                <option value="13"<%if day(date())="13" then response.write "selected"%>><font color="#000000">13</font></option>
                <option value="14"<%if day(date())="14" then response.write "selected"%>><font color="#000000">14</font></option>
                <option value="15"<%if day(date())="15" then response.write "selected"%>><font color="#000000">15</font></option>
                <option value="16"<%if day(date())="16" then response.write "selected"%>><font color="#000000">16</font></option>
                <option value="17"<%if day(date())="17" then response.write "selected"%>><font color="#000000">17</font></option>
                <option value="18"<%if day(date())="18" then response.write "selected"%>><font color="#000000">18</font></option>
                <option value="19"<%if day(date())="19" then response.write "selected"%>><font color="#000000">19</font></option>
                <option value="20"<%if day(date())="20" then response.write "selected"%>><font color="#000000">20</font></option>
                <option value="21"<%if day(date())="21" then response.write "selected"%>><font color="#000000">21</font></option>
                <option value="22"<%if day(date())="22" then response.write "selected"%>><font color="#000000">22</font></option>
                <option value="23"<%if day(date())="23" then response.write "selected"%>><font color="#000000">23</font></option>
                <option value="24"<%if day(date())="24" then response.write "selected"%>><font color="#000000">24</font></option>
                <option value="25"<%if day(date())="25" then response.write "selected"%>><font color="#000000">25</font></option>
                <option value="26"<%if day(date())="26" then response.write "selected"%>><font color="#000000">26</font></option>
                <option value="27"<%if day(date())="27" then response.write "selected"%>><font color="#000000">27</font></option>
                <option value="28"<%if day(date())="28" then response.write "selected"%>><font color="#000000">28</font></option>
                <option value="29"<%if day(date())="29" then response.write "selected"%>><font color="#000000">29</font></option>
                <option value="30"<%if day(date())="30" then response.write "selected"%>><font color="#000000">30</font></option>
                <option value="31"<%if day(date())="31" then response.write "selected"%>><font color="#000000">31</font></option>
              </select>
            日 </font>