• 年月日下拉联动代码


    这是JS的代码:

     function getSDay(){
               var year ;
               var month ;
               var maxday=0 ;
              
               with( document.sedate.syear ){
                year = options[selectedIndex].text; 
               }
              
               with( document.sedate.smonth ){
                month = options[selectedIndex].text;
               }
              
               if( month==1 | month==3 | month==5 | month==7 | month==8 | month==10 | month==12 ){
                 maxday = 31 ;
               }else if( month==4 | month==6 | month==9 | month==11 ){
                 maxday = 30 ;
               }else if( month == 2 ){
                 if( (year%4==0 & year%100!=0) | year%400==0 ){
                   maxday = 29 ;
                 }else{
                  maxday = 28 ;
                 }
               }
              
               with( document.sedate.sday ){
                length = maxday+1;
                options[0].text="--不限";
              options[0].value="--不限";
                for( var i=1;i<maxday+1;i++ ){
                  options[i].text=i;
                  options[i].value=i;
                }
               }
             }
            
             function getEDay(){
            var year ;
            var month ;
            var maxday=0 ;
           
            with( document.sedate.eyear ){
             year = options[selectedIndex].text; 
            }
           
            with( document.sedate.emonth ){
             month = options[selectedIndex].text;
            }
           
            if( year!="--不限" ){
             if( month==1 | month==3 | month==5 | month==7 | month==8 | month==10 | month==12 ){
               maxday = 31 ;
             }else if( month==4 | month==6 | month==9 | month==11 ){
               maxday = 30 ;
             }else if( month == 2 ){
               if( (year%4==0 & year%100!=0) | year%400==0 ){
                 maxday = 29 ;
               }else{
                maxday = 28 ;
               }
             }
            }
           
            with( document.sedate.eday ){
              length = maxday+1;
              options[0].text="--不限";
              options[0].value="--不限";
                for( var i=1;i<maxday+1;i++ ){
                  options[i].text=i;
                  options[i].value=i;
                }
               }
          }
    这是JSP的代码:
    <%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
       
        <title>My JSP 'date.jsp' starting page</title>
       
     <meta http-equiv="pragma" content="no-cache">
     <meta http-equiv="cache-control" content="no-cache">
     <meta http-equiv="expires" content="0">   
     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
     <meta http-equiv="description" content="This is my page">
     <!--
     <link rel="stylesheet" type="text/css" href="styles.css">
     -->
     <script language="javascript" src="MyJavaScript/date.js" ></script>
      </head>
       
      <body>
        <form action="" name="sedate">
     
         <table border="1"  width="1000" align="center" >
          <tr>
           <td>
            选择时间:
           </td>
           <td>
            <select  name="syear" onchange="getSDay()" >
                <option selected>--不限</option>
                <%
                 for( int i=0;i<30;i++ ){
                 %>
                <option><%=1990+i%></option>
                <% }%>
         </select>
        
           </td>
           <td></td>
           <td>
            <select name="smonth" onchange="getSDay()">
                <option selected>--不限</option>
                <%
                 for( int i=1;i<13;i++ ){
                 %>
                <option ><%=i%></option>
                <% }%>
         </select>
           </td>
           <td></td>
           <td>
            <select name="sday" >
                <option selected>--不限</option>
         </select>
           </td>
           <td></td>
           <td></td>
           <td>
            <select name="eyear"  onchange="getEDay()">
                <option selected>--不限</option>
                <%
                 for( int i=0;i<30;i++ ){
                 %>
                <option><%=1990+i%></option>
                <% }%>
         </select>
           </td>
           <td></td>
           <td>
            <select name="emonth" onchange="getEDay()">
                <option selected>--不限</option>
                <%
                 for( int i=1;i<13;i++ ){
                 %>
                <option ><%=i%></option>
                <% }%>
         </select>
           </td>
           <td></td>
           <td>
            <select name="eday">
                <option selected>--不限</option>
         </select>
           </td>
           <td></td>
          </tr>
          </table>
          </form>
           </body>
    </html>

    在WEBROOT下建个文件夹MyJavaScript,把JS放进去,然后把文件夹和JS放WEBROT下,就可以了。

  • 相关阅读:
    (转)The Road to TensorFlow
    (转) TensorFlow深度学习,一篇文章就够了
    论文笔记之:Fully-Convolutional Siamese Networks for Object Tracking
    关于 Local feature 和 Global feature 的组合
    (转) 技术揭秘:海康威视PASCAL VOC2012目标检测权威评测夺冠之道
    (转)一文学会用 Tensorflow 搭建神经网络
    (转)TensorFlow 入门
    (转)阿尔法狗是怎么用机器学习做决策的
    How to Configure the Gradient Boosting Algorithm
    A Gentle Introduction to the Gradient Boosting Algorithm for Machine Learning
  • 原文地址:https://www.cnblogs.com/webqiand/p/4609732.html
Copyright © 2020-2023  润新知