简体   繁体   English

HTML 中的下拉组合框(使用 Javascript 或 JQuery)?

[英]Drop-Down Combo-box in HTML (with Javascript or JQuery)?

I've seen this question many times online, but none of them really have what I need.我在网上多次看到这个问题,但没有一个真正有我需要的东西。

Is there any available multi-select drop-down combo-box written in Javascript available, so that I can avoid reinventing the wheel?是否有可用的用 Javascript 编写的多选下拉组合框,这样我就可以避免重新发明轮子?
(I'm still learning web programming, so I'm not too comfortable with making my own pop-ups yet...) (我还在学习 web 编程,所以我还不太习惯制作自己的弹出窗口......)

What I need is pretty much this :我需要的几乎是这样的:


(source: googlecode.com ) (来源: googlecode.com

However, this one has several flaws:但是,这个有几个缺陷:

  • The latest version doesn't seem to have the button on the side最新版好像没有侧面的按钮
  • The width grows arbitrarily big, or remains a fixed size (I need a "maximum width" option)宽度任意增大,或保持固定大小(我需要“最大宽度”选项)
  • The control should look native in the browser, not custom-made.该控件应该在浏览器中看起来是原生的,而不是定制的。 The arrow here is just a PNG file, and it pays no attention to what the browser actually displays for a regular combo-box.这里的箭头只是一个 PNG 文件,它不注意浏览器实际显示的常规组合框的内容。

Any ideas?有任何想法吗?

There are plenty of plugins available which I think you're already aware of.有很多可用的插件,我想你已经知道了。 However, I'm not sure if there is a way to detect how the browser renders it actually. 但是,我不确定是否有办法检测浏览器实际呈现它的方式。

Even in IE/XP, there's no easy way to tell if Visual styles are turned off or not (other than hacks like scrollbar width calculation etc). 即使在 IE/XP 中,也没有 简单的方法来判断 Visual styles 是否关闭(除了滚动条宽度计算等黑客攻击)。

Found one that claims to have native look and feel (not sure if you can do checkboxes in options): http://www.thunderguy.com/semicolon/2009/07/16/simple-combo-box-jquery-plugin/找到一个声称具有原生外观和感觉的(不确定是否可以在选项中添加复选框): http://www.thunderguy.com/semicolon/2009/07/16/simple-combo-box-jquery-plugin/

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

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