简体   繁体   English

HTML muliple select应该看起来像HTML select

[英]HTML muliple select should look like HTML select

alt text http://www.freeimagehosting.net/image.php?a55fa98f01.jpg Hi I am trying to use a HTML select box with 'multiple' select options and size to 1 as below ` alt text http://www.freeimagehosting.net/image.php?a55fa98f01.jpg您好我正在尝试使用带有“多个”选项的HTML选择框,大小为1,如下所示

<SELECT NAME="toppings" MULTIPLE SIZE=5>
<OPTION VALUE="mushrooms">mushrooms
<OPTION VALUE="greenpeppers">green peppers
</SELECT>

When the size is set to 1 small scrollbar appears which makes the page clumsy.If I increase the size its eating up my page since there are around 20 such multiple boxes in and around the page. 当大小设置为1时,会出现一个小的滚动条,这会使页面变得笨拙。如果我增加了大小,它会占用我的页面,因为页面内和周围有大约20个这样的多个框。 I am looking for a solution which looks like <SELECT> but should function as multiple Is this possible. 我正在寻找一个看起来像<SELECT>的解决方案,但应该起多个作用这是可能的。 I remember seen something similar but don't remember exactly. 我记得看过类似的东西,但不记得确切。 Any ideas 有任何想法吗

I had uploaded the image Sample http://www.freeimagehosting.net/image.php?a55fa98f01.jpg 我上传了图片样本http://www.freeimagehosting.net/image.php?a55fa98f01.jpg

Check out this code ... it turns your multi-row select into a dropdown with checkboxes using jQuery. 看看这段代码 ......它将你的多行选择变成一个带有jQuery复选框的下拉列表。

code.google.com/p/dropdown-check-list code.google.com/p/dropdown-check-list

I'm going to go in bit of a different direction with this one: 我会用这个方向走一个不同的方向:

You really, really need to rethink your design if you need to do what you are doing here. 如果你需要做你在这里做的事情,你真的, 真的需要重新考虑你的设计。 You might also want to pick up a book on HTML; 你可能还想拿一本关于HTML的书; and interface design in general. 和界面设计一般。

When things look a certain way, that gives people certain expectations: A single-select should always look like a single-select, and a multiple-select should never look like a single-select. 当事情看起来一定的方式,给人们一定的期望:单选择应该总是看起来像一个单选和多选应该看起来像一个单一选择。

You can't get a multiple select to display as a regular select. 您无法将多重选择显示为常规选择。 If you could, how would you expect the user to select multiple values ? 如果可以,您希望用户如何选择多个值?

That being said, the solution would be to create your own custom solution or use one of the jquery plugin out there. 话虽这么说,解决方案是创建自己的自定义解决方案或使用其中一个jquery插件。

You can't hide the scroll bar in a multi-select... otherwise it would look like a text-area and may confuse a user. 您无法在多选中隐藏滚动条...否则它看起来像文本区域并且可能会使用户感到困惑。 If you really want to hide it, make a div and float it over the area of the scrollbar to simulate hiding it. 如果你真的想要隐藏它,请创建一个div并将其浮动在滚动条的区域上以模拟隐藏它。 I don't recommend it but its a possibility. 我不推荐它,但它有可能。

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

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