Home >Backend Development >PHP Tutorial >下拉菜单如何关联阿。()

下拉菜单如何关联阿。()

WBOY
WBOYOriginal
2016-06-13 09:59:501009browse

下拉菜单怎么关联阿。(高手指点)
页面两个下拉菜单。要怎么关联起来阿
例如:这是奥运会的项目。
两个下拉菜单。一个菜单男女,一个菜单是男女的项目名称



------解决方案--------------------

HTML code
<script type="text/javascript">function select(){var ename=document.f1.ename.value;var names=new Array(3);names['男']=['拳击','棒球'];names['女']=['女子摔跤','平衡术'];document.f1.film.length=0;//清空下拉列表的值for( var i=0;i<names[ename].length;i++){var newoption=new Option(names[ename][i],names[ename][i]);//创建新的选项var film=document.f1.film;//得到下拉列表对象film.options.add(newoption);//添加}}</script>        



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn