gpt4 book ai didi

javascript - onchange 函数不起作用

转载 作者:行者123 更新时间:2023-11-28 21:17:09 25 4
gpt4 key购买 nike

<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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com