为什么HTML 5没有内置的可编辑组合框或本地菜单? [英] Why does HTML 5 not have editable combobox or local menus built in?

查看:446
本文介绍了为什么HTML 5没有内置的可编辑组合框或本地菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,在新的HTML 5中,我们将获得< audio>和< video>标签,但为什么不是原生的可编辑组合框并内置本地菜单支持?

I was wondering, in the new HTML 5, we will get <audio> and <video> tags, but why not native editable combobox and built in local menu support?

我之所以这么说是因为当我必须为典型的基于表格的应用程序(例如订单管理应用程序)设计Web解决方案时,这些是我遇到的最常见的问题。在适当的客户端应用程序上,我可以使用操作系统提供开箱即用的这些功能(例如JPopupMenu,JComboBox)。对于一个webapp,我必须寻找javascript(库)来完成类似的事情。

The reason I'm asking this is because these are the most common problems I face when I have to design a web solution to a typical table based application (e.g. order management app). On a proper client side app, I can use the OS to provide these facilities out of box (e.g. JPopupMenu, JComboBox). For a webapp, I have to look for javascript (libraries) to accomplish something like it.

为什么这些不在HTML 5中?

我知道我应该避免像问题一样讨论,所以这里还有一些问题:你知道库可以做便宜的弹出式菜单和可编辑组合框的东西(也许用一个小代码样本)?

I know I should avoid discussion like questions, so here are some further questions: Do you know libraries that can do the popup menu thing and editable combobox thing cheaply (perhaps with a small code sample)?

推荐答案

实际上,可以使用以下方法创建一个可编辑的组合框或只是组合框输入元素上的新列表属性。它指向一个datalist元素,它可以提供预定义选项列表:

Actually, an editable combobox or just combobox can be created using the new list attribute on the input element. It points to a datalist element that can provide a list of predefined options:

<input list=languages>
<datalist id=languages>
 <option value="English"></option>
 <option value="Dutch"></option>
</datalist>

对于菜单,旧的菜单元素已被重复使用。

For menus the old menu element has been reused.

你可以在IE> = 10,Firefox> = 37,Chrome> = 39,Opera> = 29时至少使用datalist。来自 caniuse datalist 。关于menu元素,只有Firefox似乎对它有部分支持。

You can use at least datalist in IE >=10, Firefox >=37, Chrome >= 39, Opera >= 29. Data from caniuse datalist. About menu element, only Firefox seems to have a partial support for it.

这篇关于为什么HTML 5没有内置的可编辑组合框或本地菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆