CSDN博客

img javaxl

显示日期的下拉菜单

发表于2004/7/16 10:57:00  890人阅读

将一下部分加入到<body></doby>中的任意位置

<script language="javascript">
function nowtime()
{
 var da,ny,nm,nd;
 da = new Date();
 ny = da.getYear();
 nm = da.getMonth();
 nd = da.getDate();
 document.form1.year2.value = ny;
 document.form1.month2.value = nm+1;
 document.form1.day2.value = nd;
}
</script>
    <form name="form1" method="post" action="#">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      
        <tr>
          <td height="30">
            <select name="year2" >
              <option value="2002">2002</option>
              <option value="2003">2003</option>
              <option value="2004">2004</option>
            </select>
            年
            <select name="month2">
              <option value="1">1</option>
              <option value="2">2</option>
              <option value="3">3</option>
              <option value="4">4</option>
              <option value="5">5</option>
              <option value="6">6</option>
              <option value="7">7</option>
              <option value="8">8</option>
              <option value="9">9</option>
              <option value="10">10</option>
              <option value="11">11</option>
              <option value="12">12</option>
            </select>
            月
            <select name="day2">
              <option value="1">1</option>
              <option value="2" >2</option>
              <option value="3" >3</option>
              <option value="4" >4</option>
              <option value="5" >5</option>
              <option value="6" >6</option>
              <option value="7" >7</option>
              <option value="8" >8</option>
              <option value="9" >9</option>
              <option value="10" >10</option>
              <option value="11" >11</option>
              <option value="12" >12</option>
              <option value="13" >13</option>
              <option value="14" >14</option>
              <option value="15" >15</option>
              <option value="16" >16</option>
              <option value="17" >17</option>
              <option value="18" >18</option>
              <option value="19" >19</option>
              <option value="20" >20</option>
              <option value="21" >21</option>
              <option value="22" >22</option>
              <option value="23" >23</option>
              <option value="24" >24</option>
              <option value="25" >25</option>
              <option value="26" >26</option>
              <option value="27" >27</option>
              <option value="28" >28</option>
              <option value="29" >29</option>
              <option value="30" >30</option>
              <option value="31" >31</option>
            </select>
            日
            <script language="Javascript">
      if (this.form1.month2!="")
    {nowtime()}
     </script>
                     </td>
        </tr>
      
      </table>
   </form>

0 0

相关博文

我的热门文章

img
取 消
img