树的展开的问题 我写了function expandIt(el)一个展开的函数,点击节点<A onclick="expandIt('<%=aaa%>'); return false">,调用这个展开函数,执行结果是成功的;我想在显示的时候默认展开第二个节点,于是在jsp页面中加了expandIt('<%=aaa%>'); 这么一段javaScript脚本,函数也执行了,可是树节点就是没有展开 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 三个文件,自己看着分别存。xml,xsl,htm<?xml version="1.0" encoding="GB2312" ?><?xml-stylesheet type="text/xsl" href="tree.xsl" ?><tree> <node title="中国"> <node title="江苏"> <node title="泰州"> <node title="白马" /> </node> <node title="徐州" /> <node title="南京" /> <node title="无锡" /> </node> <node title="上海"> <node title="徐家汇" /> <node title="莘庄" /> <node title="中山公园" /> </node> <node title="北京" /> <node title="四川" /> <node title="海南" /> </node> <node title="米国"> <node title="加利福利亚" /> <node title="纽约" /> </node> <node title="伊拉克" /> </tree><?xml version="1.0" encoding="GB2312" ?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="node"> <div> <span onclick="toggle(this)" class=""> <xsl:choose> <xsl:when test="count(*)>0"> ─</xsl:when> <xsl:otherwise> ·</xsl:otherwise> </xsl:choose> </span> <span> <xsl:value-of select="@title" /> </span> </div> <div class="indent"> <xsl:apply-templates select="./node" /> </div> </xsl:template></xsl:stylesheet><style>body{ background-color: #eeeeee; font-size:14;}div{ cursor:hand; }div.indent{ padding-left: 30;}span{ border:1px solid; border-color:#999999; font-size:14; height:18;}span.{ width:15; height:15; text-align:center; border:1px solid; border-color:#999999; font-size:10; background-color:white; }</style><SCRIPT > function toggle(s){ var d = s.parentElement.nextSibling; if (d.childNodes.length > 0) { if (d.style.display == '') { d.style.display = 'none'; s.innerText = '┼'; } else { d.style.display = ''; s.innerText = '─'; } }}function document.onselectstart(){ document.selection.clear();}var xmldoc, xsldoc;xmldoc = new ActiveXObject("Microsoft.XMLDOM");xmldoc.async = false;xmldoc.load("tree.xml");xsldoc = new ActiveXObject("Microsoft.XMLDOM");xmldoc.async = false;xsldoc.load("tree.xsl");document.write('<div id="tree">' + xmldoc.transformNode(xsldoc) + '</div>'); </SCRIPT> 谢谢老狼同志,不过我对xml不是很熟,主要是我的jsp代码太多了,不是很好改,其实我的问题说白了,就是在生成树的时候怎么将一个目录打开 大笨狼地树结构不错哦~~我也学了点,谢谢问一点...如果我在在每个叶结点做个连接,如何改进呢?比如上面说地,我在中国->江苏->泰州->白马 上做个连接,如何? js有没比较好的案例,实战书籍。 extjs json 错误 invalid label 在<div>中如何引用JavaScript变量 如果让只能web方式下载 想大家求一正则,请进 构造innerHTML时出现的问题。 100分,求高手帮忙! 救命啊,帮我看看源代码啊。。。实现不了弹出窗口的? 怎样实现IE菜单中的目标另存为? 怎么令网页刷新时不要响? username为空或不是对象? selectIndex为啥取不到!!!!很急的几个关于Javascript开发页面的问题,在线等待!!!!
<?xml-stylesheet type="text/xsl" href="tree.xsl" ?>
<tree>
<node title="中国">
<node title="江苏">
<node title="泰州">
<node title="白马" />
</node>
<node title="徐州" />
<node title="南京" />
<node title="无锡" />
</node>
<node title="上海">
<node title="徐家汇" />
<node title="莘庄" />
<node title="中山公园" />
</node>
<node title="北京" />
<node title="四川" />
<node title="海南" />
</node>
<node title="米国">
<node title="加利福利亚" />
<node title="纽约" />
</node>
<node title="伊拉克" />
</tree>
<?xml version="1.0" encoding="GB2312" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="node">
<div>
<span onclick="toggle(this)" class="">
<xsl:choose>
<xsl:when test="count(*)>0">
─</xsl:when>
<xsl:otherwise>
·</xsl:otherwise>
</xsl:choose>
</span>
<span>
<xsl:value-of select="@title" />
</span>
</div>
<div class="indent">
<xsl:apply-templates select="./node" />
</div>
</xsl:template>
</xsl:stylesheet><style>
body
{
background-color: #eeeeee;
font-size:14;
}
div
{
cursor:hand;
}
div.indent
{
padding-left: 30;}span
{
border:1px solid;
border-color:#999999;
font-size:14;
height:18;
}
span.
{
width:15;
height:15;
text-align:center;
border:1px solid;
border-color:#999999;
font-size:10;
background-color:white;
}
</style><SCRIPT >
function toggle(s)
{
var d = s.parentElement.nextSibling;
if (d.childNodes.length > 0)
{
if (d.style.display == '')
{
d.style.display = 'none';
s.innerText = '┼';
}
else
{
d.style.display = '';
s.innerText = '─';
}
}
}function document.onselectstart()
{
document.selection.clear();
}var xmldoc, xsldoc;
xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.async = false;
xmldoc.load("tree.xml");
xsldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.async = false;
xsldoc.load("tree.xsl");document.write('<div id="tree">' + xmldoc.transformNode(xsldoc) + '</div>');
</SCRIPT>
我也学了点,谢谢问一点...如果我在在每个叶结点做个连接,如何改进呢?比如上面说地,我在中国->江苏->泰州->白马 上做个连接,如何?