html网页下拉后触发事件,是不是onselect事件
我错在哪里了?<html><head><script>functionmm(){vari=document.frm1.select1.selectedIndex;vara...
我错在哪里了?
<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> 展开
<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> 展开
1个回答
展开全部
是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>
<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>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询