代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表单验证</title>
<script type="text/javascript">
window.onload = function () {
var selectBtn = document.getElementById("select");
selectBtn.onchange=function(){
alert(this.value);
}
}
</script>
</head>
<body>
<select id="select">
<option value="001">香蕉</option>
<option value="002">苹果</option>
<option value="003">梨</option>
</select>
</body>
</html>
结果: