<html>
<head>
<script type="text/javascript">
function getElements(){
var x=document.getElementsByTagName("select");
for(var i=0; i<x.length; i++){
alert(x[i][x[i].selectedIndex].value);
}
}
</script>
</head>
<body>
<select>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
</select>
<br />
<select>
<option value=a>a</option>
<option value=b>b</option>
<option value=c>c</option>
</select>
<br />
<input type="button" onclick="getElements()" value="选中了什么?" />
</body>
</html>
<head>
<script type="text/javascript">
function getElements(){
var x=document.getElementsByTagName("select");
for(var i=0; i<x.length; i++){
alert(x[i][x[i].selectedIndex].value);
}
}
</script>
</head>
<body>
<select>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
</select>
<br />
<select>
<option value=a>a</option>
<option value=b>b</option>
<option value=c>c</option>
</select>
<br />
<input type="button" onclick="getElements()" value="选中了什么?" />
</body>
</html>