zoukankan      html  css  js  c++  java
  • 三级联动,之前那个代码太难看了 在更新一下

    <body>
    年<select id="a"></select>
    月<select id="b">
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
    <option>6</option>
    <option>7</option>
    <option>8</option>
    <option>9</option>
    <option>10</option>
    <option>11</option>
    <option>12</option>
    </select>
    日<select id="c">

    </select>
    </body>
    </html>
    <script>
    a=document.getElementById("a");
    b=document.getElementById("b");
    c=document.getElementById("c");

    a.onblur=function(){
    aa=a.value;
    }

    for(x=1900;x<=2017;x++){
    a.options.add(new Option(x))
    }

    b.onblur=function(){

    if(b.value==2&&((aa%4==0&&aa%100!=0)||aa%400==0)){

    for(x=1;x<=29;x++){

    e=document.createElement("option")
    e.innerHTML=x;
    c.appendChild(e);
    }
    }

    else if(b.value==2&&((aa%4!=0&&aa%100==0)||aa%400!=0)){
    for(x=1;x<=28;x++){

    e=document.createElement("option")
    e.innerHTML=x;
    c.appendChild(e);
    }
    }

    else if(b.value==1||b.value==3||b.value==5||b.value==7||b.value==8||b.value==10||b.value==12){
    for(x=1;x<=31;x++){

    e=document.createElement("option")
    e.innerHTML=x;
    c.appendChild(e);
    }
    }

    else if(b.value==4||b.value==6||b.value==9||b.value==11)
    for(x=1;x<=30;x++){

    e=document.createElement("option")
    e.innerHTML=x;
    c.appendChild(e);
    }


    }

    </script>

  • 相关阅读:
    ABAP 动态内表构建 Dynamic internal table
    RFC权限分配
    ERP从业来的总结
    WORD中插入VISIO图形,打印乱码解决
    SAP中程序间的相互调用,SUBMIT关键字的用法
    SDva01的屏幕增强
    STL中的binder
    C++中的new
    C++数组中多态问题分析
    Gdiplus中实现双Buffer绘图
  • 原文地址:https://www.cnblogs.com/m110/p/7612514.html
Copyright © 2011-2022 走看看