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

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

WBOY
Release: 2016-06-13 13:50:45
Original
1093 people have browsed it

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



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

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>
  
  
  
  
Copy after login



Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template