javascript html中的多级选择
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11168257/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Multiple level select in html
提问by user1476582
I have a select box which runs a JavaScript when the option changes. Now I want to have multi level select, something like menus and submenus etc.
我有一个选择框,它在选项更改时运行 JavaScript。现在我想要多级选择,比如菜单和子菜单等。
What I want is like I have Option to select Country. As soon as mouse is cliked on country, the cities of that country are brought into the form sideways and maybe third list when city is clicked.
我想要的是我可以选择国家。一旦鼠标在国家上点击,该国家的城市就会变成横向的表格,当点击城市时可能会出现第三个列表。
I have seen in this forum where Country-City-Street type select is mentioned and solved but what I want is that the value of the select should be from the last thing (from child dropdown) selected and not something like country->city->region
我在这个论坛上看到提到并解决了 Country-City-Street 类型选择,但我想要的是选择的值应该来自最后选择的东西(来自子下拉列表),而不是像 country->city- >地区
Also to keep that onchange thing intact.
还要保持onchange 的东西完好无损。
回答by deej
There is jQuery plugin from Giva Labs called mcDropdown jQuery Plug-in v1.3.1, which serves similar purpose.
Giva Labs 有一个名为 mcDropdown jQuery Plug-in v1.3.1 的 jQuery 插件,其用途类似。
http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm
http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm
and another choice is: http://www.filamentgroup.com/lab/jquery_ipod_style_and_flyout_menus/
另一个选择是:http: //www.filamentgroup.com/lab/jquery_ipod_style_and_flyout_menus/
Take a look at it.
看一看。