这段代码加了<form>就不能正常调用onchange。而去掉<form>就可以正常调用,什么情况啊
<html><head><metahttp-equiv="Content-Type"content="text/html;charset=utf-8"><title>js...
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>js获取select(下拉框的值)的值</title>
<script language="javascript">
function bir()
{
var m=document.getElementById("bir").value;
alert(m);
}
</script>
</head>
<body>
<form name="newuser" method="POST" action="join.php" onSubmit="return join();">
<select id="bir" name="bir" onchange='javascript:bir();'>
<option value="null" selected>选择</option>
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
</form>
</body>
</html> 展开
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>js获取select(下拉框的值)的值</title>
<script language="javascript">
function bir()
{
var m=document.getElementById("bir").value;
alert(m);
}
</script>
</head>
<body>
<form name="newuser" method="POST" action="join.php" onSubmit="return join();">
<select id="bir" name="bir" onchange='javascript:bir();'>
<option value="null" selected>选择</option>
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
</form>
</body>
</html> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询