<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>测试页</title>
</head><body><form name=form1>
<input name="t1" type="checkbox" onclick="check(this)" value="1">
<input name="t2" type="checkbox" onclick="check(this)" value="2">
<table>
<tr id="tr1"><td>1111111111111111</td></tr>
<tr id="tr2"><td>22222222222222222</td></tr>
</table>
</form>
<script language="javascript">
<!--
function check(obj)
{
var obj2=eval(document.getElementById("tr"+obj.value));
if(obj.checked==true)
{obj2.style.display="";}
else
{obj2.style.display="none";}
}
//-->
</script></body></html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>测试页</title>
</head><body><form name=form1>
<input name="t1" type="checkbox" onclick="check(this)" value="1">
<input name="t2" type="checkbox" onclick="check(this)" value="2">
<table>
<tr id="tr1"><td>1111111111111111</td></tr>
<tr id="tr2"><td>22222222222222222</td></tr>
</table>
</form>
<script language="javascript">
<!--
function check(obj)
{
var obj2=eval(document.getElementById("tr"+obj.value));
if(obj.checked==true)
{obj2.style.display="";}
else
{obj2.style.display="none";}
}
//-->
</script></body></html>
Let就是LISTBOX TR1是另一个元件
=====================
var i;
i = document.all["Let"].selectedIndex;
if(document.all["Let"].options[i].text=="AA")
{
document.getElementById("tr1").style.display="";
}
==================
这样写并没显示出来
<!--
function showbutton(src){
btnAA.style.display="none";
btnBB.style.display="none";
btnCC.style.display="none";
switch(src.value){
case 'AA': btnAA.style.display=""; break;
case 'BB': btnBB.style.display=""; break;
case 'CC': btnCC.style.display=""; break;
}
}
//-->
</script>
<select name="Let" style="width:100" onchange="showbutton(this)">
<option value="AA">AA</option>
<option value="BB">BB</option>
<option value="CC">CC</option>
</select>
<input type="button" id="btnAA" value=" AA " style="display:">
<input type="button" id="btnBB" value=" BB " style="display:none">
<input type="button" id="btnCC" value=" CC " style="display:none">