<select name="select">
<option value="aa">bb</option>
</select>select必须要有个nameaa是 form.select.option[0].value
bb是 form.select.option[0].text
<option value="aa">bb</option>
</select>select必须要有个nameaa是 form.select.option[0].value
bb是 form.select.option[0].text
怎样取出选中的option的值?
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript">
<!--
function modthis(thezujian){ //v3.0
alert(document.form1.menu1.option[0].text);
}
//-->
</script>
</head><body>
<form name="form1" method="post" action="">
<select name="menu1" onChange="modthis(this)">
<option selected value="aa">text1</option>
<option value="bb">text2</option>
</select>
</form>
</body>
</html>
出现下面的错误:
‘document.form1.menu1.option.0’为空或不是对象改为alert(document.form1.menu1.text);后:
alert出的警告是:undefined!怎么用?
document.form1.menu1.options(0).text