解决方案 »

  1.   

    window.onload=loadYear试试 页面没加载到select可能
      

  2.   

    js 应该写在select标签后面,<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     <head>
     </head> <body>
      <select id="sel">  </select>
     </body>
    </html><script>

    var sel = document.getElementById("sel");
    var opt = null;
    for(var i = 1900; i <=2500; i++){
    opt = document.createElement("option");
    opt.value = i;
    opt.innerHTML = i;
    sel.appendChild(opt);
    }
    </script>
    这样是没问题的