<!DOCTYPE html>
<html>
<head>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=GBK"/>
<title>Select选项</title>
</head>
<body>
<select id="fruitSelect" name="fruitSelect">
<option value="banana">香蕉</option>
<option value="apple">苹果</option>
<option value="orange">橘子</option>
<option value="pear">梨</option>
</select>
<input type="button" value="第一个" onclick="change(current.options[0]);"/>
<input type="button" value="上一个" onclick="change(current.options[current.selectedIndex-1]);"/>
<input type="button" value="下一个" onclick="change(current.options[current.selectedIndex+1]);"/>
<input type="button" value="最后一个" onclick="change(current.options[current.length-1]);"/>
<script type="text/javascript">
var current=document.getElementById("fruitSelect");
function change(target){
alert(target.text);
}
</script>
</body>
</head>
</html>
访问列表框select中option选项
最新推荐文章于 2024-07-20 20:11:36 发布