首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

怎么实现节点图标没展开时图标是+号 ,展开后图标变为-号

2012-02-06 
如何实现节点图标没展开时图标是+号 ,展开后图标变为-号如何实现节点图标没展开时图标是+号展开后图标变为

如何实现节点图标没展开时图标是+号 ,展开后图标变为-号
如何实现节点图标没展开时图标是+号 展开后图标变为-号 是要用js控制吗 如何实现 谢谢各位
页面如下



<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>数据展现</title>
<style type="text/css">
.spanstyle {
COLOR: #00cccc; FONT-FAMILY: 宋体; FONT-SIZE: 10pt; POSITION: absolute; TOP: -50px; VISIBILITY: visible
}
</style>
   
<script language="JavaScript1.2">
scores = new Array(20);var numTotal=0;NS4 = (document.layers) ? 1 : 0;IE4 = (document.all) ? 1 : 0;ver4 = (NS4 || IE4) ? 1 : 0;if (ver4) { with (document) { write

("<STYLE TYPE='text/css'>"); if (NS4) { write(".parent {position:absolute; visibility:visible}"); write(".child {position:absolute; 

visibility:visible}"); write(".regular {position:absolute; visibility:visible}") } else { write(".child {display:none}") }  

write("</STYLE>"); }}function getIndex(el) { ind = null; for (i=0; i<document.layers.length; i++) { whichEl = document.layers[i]; if (whichEl.id == el) {  

  ind = i; break; } } return ind;}function arrange() { nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height;  

for (i=firstInd+1; i<document.layers.length; i++) { whichEl = document.layers[i]; if (whichEl.visibility != "hide") { whichEl.pageY = nextY;  

nextY += whichEl.document.height; } }}function initIt(){ if (!ver4) return; if (NS4) { for (i=0; i<document.layers.length; i++) { whichEl = 

document.layers[i]; if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide"; } arrange(); } else { divColl = document.all.tags

("DIV"); for (i=0; i<divColl.length; i++) { whichEl = divColl(i); if (whichEl.className == "child") whichEl.style.display = "none"; } }}

function expandIt(el) {if (!ver4) return; if (IE4) { whichEl1 = eval(el + "Child");for(i=1;i<=numTotal;i++){whichEl = eval(scores[i] 

+ "Child");if(whichEl!=whichEl1) {whichEl.style.display = "none";}} whichEl1 = eval(el + 

"Child"); if (whichEl1.style.display == "none") { whichEl1.style.display = "block"; } else { whichEl1.style.display = "none"; } 

  } else { whichEl = eval("document." + el + "Child");for(i=1;i<=numTotal;i++){whichEl = eval("document." + scores[i] + 

"Child");if(whichEl!=whichEl1) {whichEl.visibility = "hide";}} if (whichEl.visibility 

== "hide") { whichEl.visibility = "show"; } else { whichEl.visibility = "hide"; } arrange(); }}onload = initIt;
</script>

<style>
<!--
.line3 {
BORDER-RIGHT: #b1e397 1px solid; BORDER-TOP: #b1e397 1px solid; BORDER-LEFT: #b1e397 1px solid; BORDER-BOTTOM: #b1e397 1px solid
}
-->
</style>

</head>

<body >
<div id='KB1Parent' class='parent'>
<b><font size="6" color="#000066" face="华文彩云">
<img border="0" src="baidu_logo.gif" width="153" height="49"></font></b><p><font color="#FF0000" size="2"></font></div><div id='KB1Child' 



class='parent'></div>
<div id='KB2Parent' class='parent'>
<a href="" onClick="expandIt('KB2'); return false">
<font color="#CC3300" size="2">
<IMG SRC='plus.gif' BORDER=0>分公司、代理商总体</font></a></div><div id='KB2Child' class='child'>
<a href='/业务分析/业务分析_核心指标.htm' target='I1'> 
<font color="#000000" size="2"><font color="#000000"> 
<IMG SRC='blank.gif' BORDER=0></font>核心指标</font></a><font size="2"><font color="#000000"><br>
</font>
<a href='/业务分析/业务分析_月发展.htm' target='I1'> 
<font color="#000000"> 
<IMG SRC='blank.gif' BORDER=0>月发展</font></a><font color="#000000"><br>
</font>
<a href='/业务分析/业务指标_用户主题.htm' target='I1'> 
<font color="#000000"> 
<IMG SRC='blank.gif' BORDER=0>用户主题</font></a><font color="#000000"><br>
</font>
<a href='/业务分析/业务指标_关键词.htm' target='I1'>
<font color="#000000"> 
<IMG SRC='blank.gif' BORDER=0>关键词</font></a></font><font color="#000000" size="2"><br>
</font>
<a href='/业务分析/业务分析_续费.htm' target='I1'> 
<font size="2" color="#000000"> 
<IMG SRC='blank.gif' BORDER=0>续费</font></a><font size="2"><font color="#000000"><br>
</font>
<a href='/业务分析/业务指标_限额.htm' target='I1'> 
<font color="#000000"> 
<IMG SRC='blank.gif' BORDER=0>限额</font></a><font color="#000000"><br>
</font>
<a href='/业务分析/业务指标_推广.htm' target='I1'> 
<font color="#000000"> 
<IMG SRC='blank.gif' BORDER=0>全国推广</font></a><font color="#000000"><br>
</font>
<a href='/业务分析/业务指标_搁置.htm' target='I1'> 
<font color="#000000"> 
<IMG SRC='blank.gif' BORDER=0>搁置</font></a><font color="#000000"><br>
</font> 
</div>




<p></font></font></div>
<p> </font></font></div>
<p> </p>
<p><font size="2"><font color="#000000"><br>
</font></div>
</body>

</html>


[解决办法]
<q id="iex">[+]</q><a id="imain" t="close" onclick="aa()">分公司、代理商总体</a>
<pre id="iopt" style="margin-left: 3em; line-height: 150%; text-align: left; display: none">
<a href='/业务分析/业务分析_核心指标.htm' target='I1'>核心指标</a>
<a href='/业务分析/业务分析_月发展.htm' target='I1'>月发展</a>
<a href='/业务分析/业务指标_用户主题.htm' target='I1'>用户主题</a>
<a href='/业务分析/业务指标_关键词.htm' target='I1'>关键词</a>
<a href='/业务分析/业务分析_续费.htm' target='I1'>续费</a>
<a href='/业务分析/业务指标_限额.htm' target='I1'>限额</a>
<a href='/业务分析/业务指标_推广.htm' target='I1'>全国推广</a>
<a href='/业务分析/业务指标_搁置.htm' target='I1'>搁置</a>
</pre>

<script language="javascript">

function aa()
{
if (imain.t=='close') { imain.t='open'; iex.innerHTML='[-]'; iopt.style.display='block'; }
else { imain.t='close'; iex.innerHTML='[+]'; iopt.style.display='none'; }
}

</script>

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


这个好啊,图片都省了

如果用图片的话就用js更换图片的src就OK了

探讨
<q id="iex">[+] </q> <a id="imain" t="close" onclick="aa()">分公司、代理商总体 </a>
<pre id="iopt" style="margin-left: 3em; line-height: 150%; text-align: left; display: none">
<a href='/业务分析/业务分析_核心指标.htm' target='I1'>核心指标 </a>
<a href='/业务分析/业务分析_月发展.htm' target='I1'>月发展 </a>
<a href='/业务分析/业务指标_用户主题.htm' target='I1'>用户主题 </a>
<a href=…

热点排行