IE再次选择宽度问题...但是有短选项和jsf

时间:2013-05-10 10:42:13

标签: javascript html internet-explorer jsf

我解决了IE选择宽度问题,在下拉菜单中没有显示长值,如本文所述: http://jquerybyexample.blogspot.com/2012/05/fix-for-ie-select-dropdown-with-fixed.html

不幸的是,当所有选项都小于默认宽度设置时,此解决方案存在问题。在那种情况下,这段代码:

drpLst.style.width = 'auto';

在鼠标按下时使组合更小,在选项单击时更大,这使得“跳跃效果”不佳

我用这段代码解决了它:

                         <script type='text/javascript'>
                           function SetWidthToAuto(drpLst, c) {            
                                 drpLst.style.width = 'auto';  

                                  if(drpLst.clientWidth &lt; c) {
                                      drpLst.style.width = c.toString(); 
                                   }
                                   else {
                                      drpLst.style.width = 'auto';  
                                   } 
                               }  
                           function ResetWidth(drpLst, c) {  
                               drpLst.style.width =c.toString(); 
                               }  
                         </script>

c参数是宽度,我想要我的comoBox。

不幸的是,它以另一个问题结束 - 在更改选项后,未显示所选值(并且实际上已选中)。问题在于解决“跳跃效应”的代码片段:

drpLst.style.width = c.toString();

因为删除后工作正常。

我在浏览网站上使用jsf和facelests。

我会感谢任何建议。

0 个答案:

没有答案