日期:2014-05-17 浏览次数:20671 次
?
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" ontent="text/html; charset=gb2312" /> <script language="javascript"> var year = new Array(); year[0] = new Date().getFullYear(); for (var i = 1; i < 5; i++) { year[i] = year[i - 1] - 1; } function interOptions() { var option = document.getElementById('se') ; //alert(option) ; var str = ""; for (var i = 0; i < 5; i++) { str = str + "<option value=" + year[i] + ">" + year[i] + "</option>"; } //alert(str) ; option.innerHTML = str; alert(option.innerHTML) ; } </script> </head> <body onload=interOptions()> <select id="se"> </select> </body> </html>