html网页下拉后触发事件,是不是onselect事件

来源:百度知道 编辑:UC知道 时间:2024/06/20 17:31:07
我错在哪里了?

<html>
<head>
<script>
function mm()
{
var i=document.frm1.select1.selectedIndex;
var address=document.frm1.select1.options[i].value;
document.location.href=address;
}
</script>
</head>
<body onload="mm()">
<form name="frm1">
<select name="select1" onSelect="mm()">
<option selected>请选择</option>
<option value="http://www.baidu.com">百度</option>
<option value="http://www.google.com">google</option>
</select>
</form>
</body>
</html>

是onchange,不是onselect.

<html>
<head>
<script>
function mm()
{
var i=document.frm1.select1.selectedIndex;
var address=document.frm1.select1.options[i].value;
document.location.href=address;
}
</script>
</head>
<body>
<form name="frm1">
<select name="select1" onchange="mm()">
<option selected>请选择</option>
<option value="http://www.baidu.com">百度</option>
<option value="http://www.google.com">google</option>
</select>
</form>
</body>
</html>