开发者

Combo doesn't show his options

I'm developing in IE6. I have a simple combobox with three options (the empty default one, and two others).

Sometimes, this combo shows the options in the right way, like this:

Combo doesn't show his options

But other times, the combo has the same options, but it doesn't show them, like this:

Combo doesn't show his options

The options are provably there because I can put the mouse in the combo and, with the mouse wheel, I can go up and down and make a selection. But the combo doesn't open (or drilldown, I don't know the right verb).

Other combos in the same view show their options well, they have a CSS class like this:

 .myStyle { width: 170px; padding:1px 0px 1px 0px; }

This 'rebel' combo also has this style. What am I doing wrong? Is this a CSS issue?

Note that the combo is inside a cell in a table. The code is:

<se开发者_C百科lect id="mySelect" class="myStyle">
     <option value="0">&nbsp;</option>
     <option value="1">Option 1</option>
     <option value="2">Option 2</option>
</select>

In the JavaScript section, if I don't use this jQuery code, the combo options are never shown:

$("#mySelect").css("width","auto");

Because of this, at least sometimes, the combo options can be shown.


The actual answer is: replace IE6.

The rare tip to fix this annoying problem is this:

$("select").each(function(){
 $(this).css("width","auto");
 $(this).attr('size', 2).attr('size', 1);});

Yeah, I know, it's a strange patch, but it was the only idea it really works. And I repeat: change to newer IE than 6 version.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜