这篇文章介绍了js下拉框二级关联菜单效果代码具体实现
有需要的朋友可以参考一下
复制代码 代码如下:
<!DOCTYPE html PUBLIC "
//W
C//DTD XHTML
Transitional//EN" "
<html xmlns="
<head>
<meta http
equiv="Content
Type" content="text/html;charset=gb
" />
<title>双选择关联菜单</title>
</head>
<body>
<form name="doublecombo">
<p>
<select name="example" size="
" onChange="redirect(this
options
selectedIndex)">
<option>特效代码</option>
<option>网页语言</option>
<option>软件教程</option>
</select>
<select name="stage
" size="
">
<option value="/texiao/shubiao">鼠标类</option>
<option value="/texiao/chuangkou">窗口类</option>
<option value="/texiao/daohang">导航类</option>
</select>
<input type="button" name="test" value="Go!"
onClick="go()">
</p>
<script>
<!
var groups=document
doublecombo
example
options
length
var group=new Array(groups)
for (I=
; I<groups; I++)
group[I]=new Array()
group[
][
]=new Option("鼠标类"
"/texiao/shubiao")
group[
][
]=new Option("窗口类"
"/texiao/chuangkou")
group[
][
]=new Option("导航类"
"/texiao/daohang")
group[
][
]=new Option("ASP"
"/yuyan/asp")
group[
][
]=new Option("PHP"
"/yuyan/php")
group[
][
]=new Option("JSP"
"/yuyan/jsp")
group[
][
]=new Option("Dreamweaver"
"/ruanjian/Dreamweaver")
group[
][
]=new Option("Fireworks"
"/ruanjian/Fireworks")
group[
][
]=new Option("Flash"
"/ruanjian/Flash")
group[
][
]=new Option("Photoshop"
"/ruanjian/Photoshop")
var temp=document
doublecombo
stage
function redirect(x){
for (m=temp
options
length
;m>
;m
)
temp
options[m]=null
for (I=
;I<group[x]
length;I++){
temp
options[I]=new Option(group[x][I]
text
group[x][I]
value)
}
temp
options[
]
selected=true
}
function go(){
location=temp
options[temp
selectedIndex]
value
}
//
>
</script>
</form>
</body>
</html></td>
</tr>
</table>