获得下拉列表框下文本内容,和value值

转自:http://hi.baidu.com/any110/blog/item/f45f48f3d0d701cf0a46e017.html

<html>
<head>
<script language="javascript">
function func(obj){
alert("the inner text is "+obj.options[obj.selectedIndex].innerText);

alert("the value is "+obj.options[obj.selectedIndex].value);
}
</script>
<title>test</title>
</head>
<body>
<select name="select1" onchange="func(this);">
<option value="1">一</option>
<option value="2">二</option>
<option value="3">三</option>
<option value="4">四</option>
</select>
</body>
</html>

posted @ 2008-09-12 02:15  农十四  阅读(283)  评论(0编辑  收藏  举报