<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div align="center">
<span>选择加班时间:</span>
<select id="hour">
</select>
时<select id="minute">
</select>
分<select id="second">
</select>
秒
<br/>
<input type="button" οnclick="check()" value="提交"/>
</div>
<script type="text/javascript">
var hour = document.getElementById("hour");
for (var i = 0; i < 24; i++) {
hour.options[i] = new Option(i,i);
};
var minute = document.getElementById("minute");
for (var i = 0; i < 60; i++) {
minute.options[i] = new Option(i,i);
};
var second = document.getElementById("second");
for (var i = 0; i < 60; i++) {
second.options[i] = new Option(i,i);
};
function check(){
var a = hour.options[hour.selectedIndex].text;
var b = hour.options[hour.selectedIndex].value;
alert(a);
alert(b);
}
</script>
</body>
</html>
简单的js控制页面小例子