[英]Css select drop down menu issue with ie9
I am having an issue with drop down menu in ie9. 我在ie9的下拉菜单中遇到问题。 The below code is working fine for me.
下面的代码对我来说很好用。 But on ie9 i have to click twice on the dd menu to see the options.
但是在ie9上,我必须在dd菜单上单击两次以查看选项。
any solution for ie9? IE9的任何解决方案?
<script type='text/javascript'>
function SetWidthToAuto(drpLst) {
drpLst.style.width = 'auto';
}
function ResetWidth(drpLst) {
drpLst.style.width = '150px';
}
</script>
<div style="width:150px;overflow:hidden;">
<select id="drpTechnology" style='width:150px' onchange='ResetWidth(this)'
onblur='ResetWidth(this)'
onmousedown='SetWidthToAuto(this)'>
<option value="-1">Browse me..</option>
<option value="1">Short Option</option>
<option value="2">Little bigger than short Option</option>
<option value="3">Largest option available with this select box</option>
</select>
<div>
Thanks 谢谢
Just replace onmousedown
by onclick
. 只需将
onmousedown
替换为onclick
。
You can also remove this
in the function calls and simply use this
inside the functions. 您也可以在函数调用中删除
this
,而在函数内部简单地使用this
。
Try the JSfiddle: http://jsfiddle.net/d2UUs/1 尝试JSfiddle: http : //jsfiddle.net/d2UUs/1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.