看
http://msdn.microsoft.com/library/shared/deeptree/xsl/deeptree.xsl
解决方案 »
- Asp.net的Trace的运用
- 通过httphandler获得执行方法参数的问题。
- asp.net
- __doPostBack('','')这个方法怎么用?
- 网上获取真实IP的代码,提示“当前上下文中不存在名称“Text””
- NavigateUrl 转换为 javascript形式
- 严肃点,严肃点,我给大家散分呢!祝大家新年快乐啊!
- 请问关于开发一个邮件系统,应该具备怎样的条件?请大家指教
- 想问各位兄弟一个数据库编程最头痛的问题?有多少MVP,就来多少MVP吧!
- 一個小小的想法,請大家幫個忙,我就萬分感謝了。在線等待!
- 在ASP.NET里怎样和SQL SEVER2000联接
- 新手求学,高分求优秀的ASP.Net源代码!
http://xml.sz.luohuedu.net/xml/CoolMenu/main.htm
你发现了么?
孟大侠的源代码我也看过了,还是不知道怎么实现定位的。
这个角,n天以前(上一次散分之后的第二天还是第三天)就已经涨的了:)
然后之后我就没有回答问题了,因为感觉水平不行
-不会java,不会桌面应用程序的编程,不会……
-努力充电中……
-这个是斑竹moonpiazza做的:
http://61.163.246.155/pro/XMLSelTree/Examples/Examples_02/default.htm
-这个是csdn的:
http://fason.nease.net/zhuanti/tree.htm
或
http://fason.nease.net/zhuanti/tree/XML.zip
-这个是fason做的一个数据库实现的:
http://fason.nease.net/zhuanti/tree/deeptree_db.rar
-msdn的:
http://202.118.17.204/tree/deeptree_msdn.htc
我都看了,都看不出怎么实现定位的,沾边是斑竹moonpiazza做的那个,不过只是实现了定位到第一个根节点的第一个字节点,
然后是fason做的服务器版本的那个,不过我发现他是用iframe来实现的,感觉上如果采用他的话还有很多东西要改,
fason实现定位是用这个文件里面的函数:http://202.118.17.204/tree/dtree.js------------------------
所谓定位就是这种效果:
http://www.ceocio.net/fason/deeptree/deeptree.asp?url=http://msdn.microsoft.com/library/
难在怎么定位啊
55555555555555555
我整理发到你的邮箱里面了,谢谢
- <xsl:attribute name="target">
<xsl:value-of select="@Target" />
</xsl:attribute>使用 xslt 进行 判断 , 使用 xpath 定位
很好搞定的
直接从http://www.ceocio.net/fason/deeptree/deeptree.asp那得到一串的html代码,类似于:<tr id=Node4>
<td class=Node noWrap><img id=img4 onclick=Ligth(this.nextSibling) src="http://www.ceocio.net/fason/deepttree/image/node.gif" align=absMiddle><span class="" onmousedown=Light(this) id=treeNode4 onmouseover=doOver(this) title=常见技巧 onmouseout=doOut(this) target="_blank" href="http://fason.nease.net/code/still.htm">常见技巧</span><iframe id=syncIfame4 style="display:none" name=syncIfrm4 src="about:blank" frameBorder=0 width=0 height=0></iframe></td></tr>我想它是通过父id和url直接查询出来,组成一个html串给客户端
Light函数是用于打开新窗口的:
它通过Ligth(this.nextSibling)取得this.nextSibling参数就是<span ...></span>
主要参数是:
title=常见技巧 target="_blank" href="http://fason.nease.net/code/still.htmfunction Light(o){
if(!tem)tem=o
tem.className=''
o.className='NodeFocus'
tem=o
var href=o.getAttribute("href")
var target=o.getAttribute("target")
if(href!="")window.open(href,target)
/*
这里可灵活运用,target可以是表内的另一属性,这里默认_blank
*/
}
<span>里带上了href, target参数, 用于在指定窗口打开网址
msdn网站上的采用xml+xsl来动态生成html代码, xml结构类似于这个:
<Tree>
<TreeNode NodeImgSrc="..." NodeId="..." Title="..." Href="..." Target="..."
NodeXmlSrc="...">
</Tree>
它里头带了Href和Target参数, deeptree.xsl中对xml进行解析:<xsl:choose>
<xsl:when test="@Href">
<a>
<xsl:choose>
<xsl:when test="@Target">
<xsl:attribute name="target"><xsl:value-of select="@Target" /></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="target">fraContent</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:attribute name="tabindex">-1</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="@Href" /></xsl:attribute>
<xsl:value-of select="@Title" />
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@Title" />
</xsl:otherwise>
</xsl:choose>有target就在指定的框架中打开url, 没有指定就在fraContent框架中打开我想它大致就是这么个流程
<?xml-stylesheet type="text/xsl" href="deeptree.xsl"?>
<Tree>
<TreeNode NodeImgSrc="http://www.ceocio.net/fason/deeptree/image/node.gif" NodeId="1" Title="网易网站" Href="http://www.163.com" Target="_blank" >
</TreeNode>
<TreeNode NodeImgSrc="http://www.ceocio.net/fason/deeptree/image/node.gif" NodeId="2" Title="新浪网站" Href="http://www.sina.com.cn" Target="_self">
</TreeNode>
<TreeNode NodeImgSrc="http://www.ceocio.net/fason/deeptree/image/expand.gif" NodeId="3" Title="我的目录"
Href="#" NdeXmlSrc="deeptree2.xml">
</TreeNode>
</Tree>
现在我能展开任意一个根结点,就是展开子节点老是有问题,
我用getElementById();找到的对象总是为空,可是我用alert(document.body.innerHTML),看的时候这个对象明明是有的,
这是一个span对象
的是吗? 直接输出html代码?
取得为空是不是把结点都套在<form>里了?
因为我的xml文件都是静态的
function GetHtmlElement(objParent,strChildTagName,strType)
改一改它
我发现msdn可能也因为用getElementById();不行才会在GetHtmlElement函数里
用循环来解决
你是不是做过?
能不能发到
-
谢谢
比如说这种节点是
-1
-1.1
-1.1.1
这种形式,
我用
var urlParam=window.location.search.substring(1);
var urlParams=window.location.search.substring(1).split("&");
vId=urlParams[0].substring(urlParams[0].indexOf("=")+1);
bId=urlParams[1].substring(urlParams[1].indexOf("=")+1);
//
var objXMLDoc_Child = new ActiveXObject("Microsoft.XMLDOM");
objXMLDoc_Child.async = false;
objXMLDoc_Child.load("1/top.xml");
var root=objXMLDoc_Child.ducumentElement;
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.load("1/top.xml");
var root=xmlDoc.documentElement;
var nodeList;
nodeList=xmlDoc.getElementsByTagName("TreeNode");
var fileBoard;//板块
for(i=0;i<nodeList.length;i++)
{
if("infoplat"+vId==nodeList.item(i).getAttribute("NodeId"))
{
fileBoard=nodeList.item(i).getAttribute("NodeXmlSrc");
break;
}
}
node=top.document.getElementById("infoplat"+vId);
ExpandNode(node.parentElement);
这些语句获得节点1.1,然后我想用一个循环获得所有的字节点,根据id找到我想要的节点:
var spans=node.parentElement.getElementsByTagName("SPAN");
var boardNode=null;
for(i=0;i<spans.length;i++)
{
alert(spans[i].id);
if(spans[i].id.toString()=="infoplat100")
{
boardNode=spans[i];
alert("dddddddddd");
break;
}
}
加上了alert("可以是任意的文本");是可以获得的,而且不单是alert,confirm也好用,
但是去掉了弹出对话框的语句之后我发现spans.length竟然是0!这是为什么呢?
问题是我应该把代码写在那里面呢,总不能等到用户点击一下才能看到展开的菜单吧?