日期:2014-05-16 浏览次数:20308 次
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>新建网页 1</title> </head> <body> <select id="selectYear"></select> <script language="javascript"> <!-- var startYear=1990;//起始年份 var endYear=new Date().getUTCFullYear();//终止年份(当前年份) var obj=document.getElementById('selectYear') onload=function(){ for (var i=startYear;i<=endYear;i++)obj.options.add(new Option(i,i)); obj.options[obj.options.length-1].selected=1 } //--> </script> </body> </html>
------解决方案--------------------
www.515dns.com
希望能帮到你
------解决方案--------------------
向1楼的学习了,在Google上找到篇博客,也是讲HTML中select标签的属性和DOM操纵的
http://www.cnblogs.com/kensonwang/archive/2007/06/28/798984.html