简体   繁体   English

如何在添加选项时保持 HTML 选择展开

[英]How to hold a HTML select expanded while adding options

I am trying to add options to a select in its onclick event and works fine in Firefox and IE but... IE close the list after filling it although Mozilla holds the list expanded我正在尝试在其onclick事件中向选择添加选项,并且在 Firefox 和 IE 中工作正常,但是... IE 在填充列表后关闭列表,尽管 Mozilla 将列表保持在展开状态

¿Are there any way to hold expanded the list (or reexpand the list with JavaScript) in IE? ¿ 有没有办法在 IE 中保持扩展列表(或使用 JavaScript 重新扩展列表)? (I am using IE 7.0) (我使用的是 IE 7.0)

Thanks!谢谢!

No, not far as I know.不,据我所知。 The IE redraws the part that is changed, and therefore reset the "design" surface. IE 重新绘制更改的部分,因此重置“设计”表面。 That's why this happens.这就是为什么会发生这种情况。 What you can do, add the options on the onMouseOver event.您可以做什么,在 onMouseOver 事件上添加选项。 That should occur before the onClick .这应该发生在onClick之前。

A good reference on all events for the IE is in the library.关于 IE 的所有事件的一个很好的参考在库中。 http://msdn.microsoft.com/en-us/library/ms535893%28VS.85%29.aspx# http://msdn.microsoft.com/en-us/library/ms535893%28VS.85%29.aspx#

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM