是否可以使用复选框生成下拉列表?
我只看到了只生成下拉列表的javascript代码。
这是我写的脚本:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Test</title>
<script type="text/javascript">
function test() {
var d = new Date();
var currentYear = d.getFullYear();
var currentMonth = d.getMonth();
var yroptions = "<option value='0'>select</option>";
for(var i = currentYear; i < currentYear + 5; i++)
{
yroptions += "<option value='"+i+"'>"+i+"</option>";
}
document.getElementById('ccexpy').innerHTML = yroptions;
}
</script>
</head>
<body onload="test()">
<form method="post" action="url to script">
<label for="ccexpy">Year</label>
<select id="ccexpy">
</select>
</form>
</body>
</html>