新微赢技术网

标题: [求助]通过列表选择,隐藏与显示TD中的内容 [打印本页]

作者: 第三滴眼泪$    时间: 2010-1-8 02:22
标题: [求助]通过列表选择,隐藏与显示TD中的内容
<tr>
<td height="28" colspan="3">求购类别:
<select name="ypxxone_newid" onChange="show(value)">
<option value="" selected>请选择类别</option>
<option value="<%=rs11("SMT_ypxxone_id")%>"><%=rs11("SMT_ypxxone")%></option>
<%rs11.movenext
wend
rs11.Close()
%>
</select>
</td>
</tr><script language="JavaScript">
<!--
var obj=null;
function show(v){
if (td1.style.display == "none") {
if(obj)obj.style.visibility='hidden'
if(obj=document.getElementById(v))obj.style.visibility='visible'
td1.style.display="";}
else{
td1.style.display="none";}
}//-->
</script>
<tr>
<td colspan="3" id="td1" style="display:none ">
<div id="all" style="position:relative; height:200;">
<div id="50" style="position:absolute; top: 0; left:0; visibility: hidden">
<table width="480">
<tr>
<td width="25%" height="20" align="left"><input name="checkbox_x" type="checkbox" style="border:0" value="<%=rs12("SMT_ypxxtwo_id")%>"><%=rs12("SMT_ypxxtwo")%></td>
</tr>
</table>
</div>
<div id="49" style="position:absolute; top: 0; left:0; visibility: hidden">
<table width="480" border="0" cellpadding="0" cellspacing="0" class="font">
<tr align="left">
<td width="25%" height="20" align="left"><input name="checkbox_x" type="checkbox" style="border:0" value="<%=rs13("SMT_ypxxtwo_id")%>"><%=rs13("SMT_ypxxtwo")%></td>
</tr>
</table>
</div>
<div id="48" style="position:absolute; top: 0; left:0; visibility: hidden">
<table width="480" border="0" cellpadding="0" cellspacing="0" class="font">
<tr align="left">
<td width="25%" height="20" align="left"><input name="checkbox_x" type="checkbox" style="border:0" value="<%=rs14("SMT_ypxxtwo_id")%>"><%=rs14("SMT_ypxxtwo")%></td>
</tr>
</table>
</div>
<div id="47" style="position:absolute; top: 0; left:0; visibility: hidden">
<table width="480" border="0" cellpadding="0" cellspacing="0" class="font">
<tr align="left">
<td width="25%" height="20" align="left"><input name="checkbox_x" type="checkbox" style="border:0" value="<%=rs15("SMT_ypxxtwo_id")%>"><%=rs15("SMT_ypxxtwo")%></td>
</tr>
</table>
</div>
<div id="51" style="position:absolute; top: 0; left:0; visibility: hidden">
<table width="480" border="0" cellpadding="0" cellspacing="0" class="font">
<tr align="left">
<td width="25%" height="20" align="left"><input name="checkbox_x" type="checkbox" style="border:0" value="<%=rs16("SMT_ypxxtwo_id")%>"><%=rs16("SMT_ypxxtwo")%></td>
</tr>
</table>
</div>
</div>
</td>
</tr>

怎样通过选择列表的其中一项,显示该内容,并且隐藏其他DIV,初始化时,该TD1是隐藏的。
作者: 香叶aiq格格    时间: 2010-1-8 02:22
- -||
作者: 孤独的囚鸟    时间: 2010-1-8 02:22
><script language="JavaScript">
<!--
var obj=null;
function show(v){
if (td1.style.display == "none") {
if(obj)obj.style.visibility='hidden'
if(obj=document.getElementById(v))obj.style.visibility='visible'
td1.style.display="";
}
else{
td1.style.display="none";
}
}
//隐藏显示所有Div
function HiddenShowDiv(Action)
{
var Divs=document.getElementByTagName("DIV");//获得当前网页所有Div
//循环所有Div元素
for(var i=0;i<Divs.length;i++)
{
if(Action=="hidden")
Divs[i].style.display="none";//隐藏Div
else
Divs[i].style.display="inline";//显示Div
}
}
//-->
</script>




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2