<script type="text/javascript">
function urlchange() {
var val = document.getElementById('fix');
e = val.options[val.selectedIndex].value;
window.open('e','mywindow','width=500,height=500')
}
</script>
</head>
<body>
<select id="fix" onblur="urlchange()">
<option selected="selected">select</option>
<option value="http://www.airtel.in">airtel</option>
<option value="http://google.in">google</option>
</select>
</body>
</html>
最佳答案
你已经编写了这段代码,以便在模糊时触发......!!! 如果您想要 onchange,请尝试以下操作:
<script type="text/javascript">
function urlchange() {
var val= document.getElementById('fix');
e=val.options[val.selectedIndex].value;
window.open(e,'mywindow','width=500,height=500')
}
</script>
<select id="fix" onchange="urlchange()">
<option selected="selected">select</option>
<option value="http://www.airtel.in">airtel</option>
<option value="http://google.in">google</option>
</select>
关于javascript - onchange 函数不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7281510/