求关于下拉框的代码!!
有2个下拉框,第二个下拉框要根据第一个下拉框的选择来决定内容。如,第一个下拉框的内容为1,2,3班第二个为学生名字选1班第二个只有一班的学生名字这个代码怎么做?用jsph...
有2个下拉框,第二个下拉框要根据
第一个下拉框的选择来决定内容。
如,第一个下拉框的内容为1,2,3
班
第二个为学生名字
选1班第二个只有一班的学生名字
这个代码怎么做?
用jsp html javascript都行。 展开
第一个下拉框的选择来决定内容。
如,第一个下拉框的内容为1,2,3
班
第二个为学生名字
选1班第二个只有一班的学生名字
这个代码怎么做?
用jsp html javascript都行。 展开
4个回答
展开全部
给你个例子,里面的数据自己改下
==============================
<html>
<head>
</head>
<body>
<script language="JavaScript">
<!--
//第一维:第一个下拉列表的值
//第二维:表示下拉列表中看到的字符串
//第三维:表示下拉列表中的值
var subcat = new Array();
//如果大类的值是动态的,则可以通过数据库中取出作如下设置
//subcat[<%=count%>] = new Array('<%=trim(rs("leemaid"))%>','<%=rs("leemaconte nt")%>','<%=rs("leemacontent")%>');
subcat[0] = new Array('1','电视机','=1')
subcat[1] = new Array('1','电风扇','=2')
subcat[2] = new Array('1','电饭煲','=3')
subcat[3] = new Array('1','电炒锅','=4')
subcat[4] = new Array('1','电灯','=5')
subcat[5] = new Array('1','电脑','=6')
subcat[6] = new Array('1','电冰箱','=7')
subcat[7] = new Array('1','洗衣机','=8')
subcat[8] = new Array('1','微波炉','=9')
subcat[9] = new Array('1','VCD影碟机','=1')
subcat[10] = new Array('2','二极管','=11')
subcat[11] = new Array('2','三极管','=12')
subcat[12] = new Array('2','CMOS集成块','=13')
subcat[13] = new Array('2','电阻','=14')
subcat[14] = new Array('2','电容','=15')
subcat[15] = new Array('2','整流二极管','=16')
subcat[16] = new Array('2','整流桥','=17')
subcat[17] = new Array('2','可控硅','=18')
subcat[18] = new Array('2','电子枪','=19')
subcat[19] = new Array('2','光敏二极管','=2')
subcat[20] = new Array('3','ffffff','vvvvvv')
subcat[21] = new Array('3','dddddd','ffffff')
function changeselect1(selectValue)
{
document.form1.s2.length = 0;//初始化下拉列表 清空下拉数据
//document.form1.s2.options[0] = new Option('请选择二级小类','');//给第一个值
for (i=0; i<subcat.length; i++)//legth=2
{
if (subcat[i][0] == selectValue)//[0] [1] 第一列 第二列
{
document.form1.s2.options[document.form1.s2.length] = new Option(subcat[i][1], subcat[i][2]);
}
}
}
//-->
</script>
<form name="form1">
二级联动:
<select name="s1" onChange="changeselect1(this.value)">
<option>请选择一级大类</option>
<option value="1">家用电器</option>
<option value="2">电子元器件</option>
<option value="3">ddddd</option>
</select>
<select name="s2" onChange="alert(this.value)">
<option>请选择二级小类</option>
</select>
</form>
</html>
==============================
<html>
<head>
</head>
<body>
<script language="JavaScript">
<!--
//第一维:第一个下拉列表的值
//第二维:表示下拉列表中看到的字符串
//第三维:表示下拉列表中的值
var subcat = new Array();
//如果大类的值是动态的,则可以通过数据库中取出作如下设置
//subcat[<%=count%>] = new Array('<%=trim(rs("leemaid"))%>','<%=rs("leemaconte nt")%>','<%=rs("leemacontent")%>');
subcat[0] = new Array('1','电视机','=1')
subcat[1] = new Array('1','电风扇','=2')
subcat[2] = new Array('1','电饭煲','=3')
subcat[3] = new Array('1','电炒锅','=4')
subcat[4] = new Array('1','电灯','=5')
subcat[5] = new Array('1','电脑','=6')
subcat[6] = new Array('1','电冰箱','=7')
subcat[7] = new Array('1','洗衣机','=8')
subcat[8] = new Array('1','微波炉','=9')
subcat[9] = new Array('1','VCD影碟机','=1')
subcat[10] = new Array('2','二极管','=11')
subcat[11] = new Array('2','三极管','=12')
subcat[12] = new Array('2','CMOS集成块','=13')
subcat[13] = new Array('2','电阻','=14')
subcat[14] = new Array('2','电容','=15')
subcat[15] = new Array('2','整流二极管','=16')
subcat[16] = new Array('2','整流桥','=17')
subcat[17] = new Array('2','可控硅','=18')
subcat[18] = new Array('2','电子枪','=19')
subcat[19] = new Array('2','光敏二极管','=2')
subcat[20] = new Array('3','ffffff','vvvvvv')
subcat[21] = new Array('3','dddddd','ffffff')
function changeselect1(selectValue)
{
document.form1.s2.length = 0;//初始化下拉列表 清空下拉数据
//document.form1.s2.options[0] = new Option('请选择二级小类','');//给第一个值
for (i=0; i<subcat.length; i++)//legth=2
{
if (subcat[i][0] == selectValue)//[0] [1] 第一列 第二列
{
document.form1.s2.options[document.form1.s2.length] = new Option(subcat[i][1], subcat[i][2]);
}
}
}
//-->
</script>
<form name="form1">
二级联动:
<select name="s1" onChange="changeselect1(this.value)">
<option>请选择一级大类</option>
<option value="1">家用电器</option>
<option value="2">电子元器件</option>
<option value="3">ddddd</option>
</select>
<select name="s2" onChange="alert(this.value)">
<option>请选择二级小类</option>
</select>
</form>
</html>
展开全部
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>级联菜单</TITLE>
<STYLE type="text/css">
td{font-size:12px;line-height:22px;color:#FFFFFF;}
div{font-size:12px;line-height:22px;}
.red {color: #FF0000}
</STYLE>
<SCRIPT language="JavaScript" >
<!--下拉框级联开始-->
var cityList = new Array( ); //定义城市数组
cityList['北京'] = ['朝阳区','东城区','西城区', '海淀区','宣武区','丰台区','怀柔','延庆','房山'];
cityList['上海'] = ['宝山区','长宁区','丰贤区', '虹口区','黄浦区','青浦区','南汇区','徐汇区','卢湾区'];
cityList['广州'] = ['天河区','海珠区','南沙区', '白云区','嘉湾区','越秀区','黄埔区','罗岗区','番寓区','花都区'];
cityList['深圳'] = ['福田区', '罗湖区', '盐田区', '宝安区', '龙岗区', '南山区', '深圳周边'];
cityList['重庆'] =['俞中区', '南岸区', '江北区', '沙坪坝区', '九龙坡区', '渝北区', '大渡口区', '北碚区', '巴南区', '万盛区', '涪凌', '江津'];
cityList['天津'] = ['和平区', '河西区', '南开区', '河北区', '河东区', '红桥区', '塘古区', '开发区', '西青区', '津南区','东丽区'];
function changeCity( )
{
var province=document.myform.province.value;
document.myform.city.options.length=0;
for (var i in cityList)
{
if (i == province)
{
for (var j in cityList[i]) //根把对应城市动态创建区域option
{
document.myform.city.options.add(new Option(cityList[i][j], cityList[i][j]));
}
}
}
document.myform.city.options.selctIndex=0;
}
function loadAll( ) //动态创建城市option
{ for (var i in cityList)
{ document.myform.province.options.add(new Option(i, i));
}
document.myform.province.selectedIndex = 0;
}
<!--下拉框级联结束-->
</SCRIPT>
</HEAD>
<BODY leftmargin="0" topmargin="0" onLoad="loadAll( )"><DIV>
<TABLE width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<TR><TD height="5"></TD></TR>
<FORM action="" method="post" name="myform">
<TR>
<TD HEGIHT="30" bgcolor="#50baf6"> <B>房源查询:</B>
<SELECT name="province" id="province" onChange="changeCity()">
<OPTION>--请选择城市--</OPTION></SELECT>
<SELECT name="city" id="city" >
<OPTION>--请选择区域--</OPTION>
</SELECT>
<SELECT ><OPTION> 物业类型</OPTION>
<OPTION> 普通住宅</OPTION>
<OPTION> 公寓</OPTION>
<OPTION> 别墅</OPTION>
<OPTION> 经济适用房</OPTION>
<OPTION> 商住楼</OPTION>
<OPTION> 写字楼</OPTION>
</SELECT> <INPUT name="b1" type="submit" value=" 查 询 "></TD>
</TR></FORM>
<TR><TD height="5"></TD></TR>
</TABLE></DIV>
</BODY>
</HTML>
我这个比较简单,上面2个写的太复杂了
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>级联菜单</TITLE>
<STYLE type="text/css">
td{font-size:12px;line-height:22px;color:#FFFFFF;}
div{font-size:12px;line-height:22px;}
.red {color: #FF0000}
</STYLE>
<SCRIPT language="JavaScript" >
<!--下拉框级联开始-->
var cityList = new Array( ); //定义城市数组
cityList['北京'] = ['朝阳区','东城区','西城区', '海淀区','宣武区','丰台区','怀柔','延庆','房山'];
cityList['上海'] = ['宝山区','长宁区','丰贤区', '虹口区','黄浦区','青浦区','南汇区','徐汇区','卢湾区'];
cityList['广州'] = ['天河区','海珠区','南沙区', '白云区','嘉湾区','越秀区','黄埔区','罗岗区','番寓区','花都区'];
cityList['深圳'] = ['福田区', '罗湖区', '盐田区', '宝安区', '龙岗区', '南山区', '深圳周边'];
cityList['重庆'] =['俞中区', '南岸区', '江北区', '沙坪坝区', '九龙坡区', '渝北区', '大渡口区', '北碚区', '巴南区', '万盛区', '涪凌', '江津'];
cityList['天津'] = ['和平区', '河西区', '南开区', '河北区', '河东区', '红桥区', '塘古区', '开发区', '西青区', '津南区','东丽区'];
function changeCity( )
{
var province=document.myform.province.value;
document.myform.city.options.length=0;
for (var i in cityList)
{
if (i == province)
{
for (var j in cityList[i]) //根把对应城市动态创建区域option
{
document.myform.city.options.add(new Option(cityList[i][j], cityList[i][j]));
}
}
}
document.myform.city.options.selctIndex=0;
}
function loadAll( ) //动态创建城市option
{ for (var i in cityList)
{ document.myform.province.options.add(new Option(i, i));
}
document.myform.province.selectedIndex = 0;
}
<!--下拉框级联结束-->
</SCRIPT>
</HEAD>
<BODY leftmargin="0" topmargin="0" onLoad="loadAll( )"><DIV>
<TABLE width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<TR><TD height="5"></TD></TR>
<FORM action="" method="post" name="myform">
<TR>
<TD HEGIHT="30" bgcolor="#50baf6"> <B>房源查询:</B>
<SELECT name="province" id="province" onChange="changeCity()">
<OPTION>--请选择城市--</OPTION></SELECT>
<SELECT name="city" id="city" >
<OPTION>--请选择区域--</OPTION>
</SELECT>
<SELECT ><OPTION> 物业类型</OPTION>
<OPTION> 普通住宅</OPTION>
<OPTION> 公寓</OPTION>
<OPTION> 别墅</OPTION>
<OPTION> 经济适用房</OPTION>
<OPTION> 商住楼</OPTION>
<OPTION> 写字楼</OPTION>
</SELECT> <INPUT name="b1" type="submit" value=" 查 询 "></TD>
</TR></FORM>
<TR><TD height="5"></TD></TR>
</TABLE></DIV>
</BODY>
</HTML>
我这个比较简单,上面2个写的太复杂了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
其中有一些是JSF组件..你把它换成普通的HMTL 就行了...
<table id="main_div">
<tr>
<td id="nav_div" valign="top">
<table cellspacing="0" border="0" width="100%">
<tr class="father_tr">
<td class="father_td">
<div class="father_div">
<img class="father_img" src="../image/icon/father_icon.png"/>
<a class="father_a" href="#" onClick="showMenu('1')"><h:outputText value="我的文件夹"/></a>
</div>
</td>
</tr>
<tr id="child1">
<td>
<table cellspacing="0">
<tr class="child_tr">
<td class="child_td">
<div class="child_div" id="child_div1" style="background-color:#bc8f8f;">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a1" onClick="markSelect('1')" href="receivedbox.faces" target="mainframe"><h:outputText value="收件箱"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" id="child_div2">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a2" onClick="markSelect('2')" href="postbox.faces" target="mainframe"><h:outputText value="发件箱"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div3">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a3" onClick="markSelect('3')" href="#"><h:outputText value="回收站"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div4">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a4" onClick="markSelect('4')" href="#"><h:outputText value="草稿箱"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div5">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a5" onClick="markSelect('5')" href="#"><h:outputText value="全部"/></a>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr class="father_tr">
<td class="father_td">
<div class="father_div">
<img class="father_img" src="../image/icon/father_icon.png"/>
<a class="father_a" href="#" onClick="showMenu('2')"><h:outputText value="我的网络硬盘"/></a>
</div>
</td>
</tr>
<tr class="child_a" id="child2" style="display:none;">
<td>
<table cellspacing="0">
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div6">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a6" onClick="markSelect('6')" href="#"><h:outputText value="音乐"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div7">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a7" onClick="markSelect('7')" href="#"><h:outputText value="照片"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div8">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a8" onClick="markSelect('8')" href="#"><h:outputText value="文档"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div9">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a9" onClick="markSelect('9')" href="#"><h:outputText value="其他"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div10">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a10" onClick="markSelect('10')" href="#"><h:outputText value="全部"/></a>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr class="father_tr">
<td class="father_td">
<div class="father_div">
<img class="father_img" src="../image/icon/father_icon.png"/>
<a class="father_a" href="#" onClick="showMenu('3')"><h:outputText value="我的通讯录"/></a>
</div>
</td>
</tr>
<tr class="child_a" id="child3" style="display:none;">
<td>
<table cellspacing="0">
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div11">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a11" onClick="markSelect('11')" href="#"><h:outputText value="朋友"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div12">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a12" onClick="markSelect('12')" href="#"><h:outputText value="家人"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div13">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a13" onClick="markSelect('13')" href="#"><h:outputText value="同事"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div14">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a14" onClick="markSelect('14')" href="#"><h:outputText value="其他"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div15">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a15" onClick="markSelect('15')" href="#"><h:outputText value="全部"/></a>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td id="content_div" valign="top">
<iframe name="mainframe" src="receivedbox.faces" frameborder="0" style="width:100%;height:100%;">
</iframe>
</td>
</tr>
</table>
JS 代码
<script language="javascript">
function showMenu(number)
{
var str="child"+number ;
var e=document.getElementById(str);
if(e.style.display=='none')
{
e.style.display='';
}
else
{ e.style.display='none';}
}
function markSelect(number)
{
var str="child_div"+number;
var e=document.getElementById(str);
for(var i=1;i<=15;i++)
{
var tem="child_div"+i;
var e_tem=document.getElementById(tem);
e_tem.style.backgroundColor='#ffffff';
}
e.style.backgroundColor='#bc8f8f';
}
</script>
一个弹出下拉菜单...
和你说的只差一步..要实现你那种也很简单的 只需要加一点点东西
估计你的水平+这个例子,应该很容易想到解决的办法的
<table id="main_div">
<tr>
<td id="nav_div" valign="top">
<table cellspacing="0" border="0" width="100%">
<tr class="father_tr">
<td class="father_td">
<div class="father_div">
<img class="father_img" src="../image/icon/father_icon.png"/>
<a class="father_a" href="#" onClick="showMenu('1')"><h:outputText value="我的文件夹"/></a>
</div>
</td>
</tr>
<tr id="child1">
<td>
<table cellspacing="0">
<tr class="child_tr">
<td class="child_td">
<div class="child_div" id="child_div1" style="background-color:#bc8f8f;">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a1" onClick="markSelect('1')" href="receivedbox.faces" target="mainframe"><h:outputText value="收件箱"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" id="child_div2">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a2" onClick="markSelect('2')" href="postbox.faces" target="mainframe"><h:outputText value="发件箱"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div3">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a3" onClick="markSelect('3')" href="#"><h:outputText value="回收站"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div4">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a4" onClick="markSelect('4')" href="#"><h:outputText value="草稿箱"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div5">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a5" onClick="markSelect('5')" href="#"><h:outputText value="全部"/></a>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr class="father_tr">
<td class="father_td">
<div class="father_div">
<img class="father_img" src="../image/icon/father_icon.png"/>
<a class="father_a" href="#" onClick="showMenu('2')"><h:outputText value="我的网络硬盘"/></a>
</div>
</td>
</tr>
<tr class="child_a" id="child2" style="display:none;">
<td>
<table cellspacing="0">
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div6">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a6" onClick="markSelect('6')" href="#"><h:outputText value="音乐"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div7">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a7" onClick="markSelect('7')" href="#"><h:outputText value="照片"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div8">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a8" onClick="markSelect('8')" href="#"><h:outputText value="文档"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div9">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a9" onClick="markSelect('9')" href="#"><h:outputText value="其他"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div10">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a10" onClick="markSelect('10')" href="#"><h:outputText value="全部"/></a>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr class="father_tr">
<td class="father_td">
<div class="father_div">
<img class="father_img" src="../image/icon/father_icon.png"/>
<a class="father_a" href="#" onClick="showMenu('3')"><h:outputText value="我的通讯录"/></a>
</div>
</td>
</tr>
<tr class="child_a" id="child3" style="display:none;">
<td>
<table cellspacing="0">
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div11">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a11" onClick="markSelect('11')" href="#"><h:outputText value="朋友"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div12">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a12" onClick="markSelect('12')" href="#"><h:outputText value="家人"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div13">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a13" onClick="markSelect('13')" href="#"><h:outputText value="同事"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div14">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a14" onClick="markSelect('14')" href="#"><h:outputText value="其他"/></a>
</div>
</td>
</tr>
<tr class="child_tr">
<td class="child_td">
<div class="child_div" class="child_a" id="child_div15">
<img class="child_img" src="../image/icon/child_icon.gif"/>
<a class="child_a" id="child_a15" onClick="markSelect('15')" href="#"><h:outputText value="全部"/></a>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td id="content_div" valign="top">
<iframe name="mainframe" src="receivedbox.faces" frameborder="0" style="width:100%;height:100%;">
</iframe>
</td>
</tr>
</table>
JS 代码
<script language="javascript">
function showMenu(number)
{
var str="child"+number ;
var e=document.getElementById(str);
if(e.style.display=='none')
{
e.style.display='';
}
else
{ e.style.display='none';}
}
function markSelect(number)
{
var str="child_div"+number;
var e=document.getElementById(str);
for(var i=1;i<=15;i++)
{
var tem="child_div"+i;
var e_tem=document.getElementById(tem);
e_tem.style.backgroundColor='#ffffff';
}
e.style.backgroundColor='#bc8f8f';
}
</script>
一个弹出下拉菜单...
和你说的只差一步..要实现你那种也很简单的 只需要加一点点东西
估计你的水平+这个例子,应该很容易想到解决的办法的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你这个是级联的效果,随便百度一下,会有很多,比如搜索:省市级联
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询