+ -
当前位置:首页 → 问答吧 → 请给我XML代码中加个连接吧[刚刚的帖子发错地方了]

请给我XML代码中加个连接吧[刚刚的帖子发错地方了]

时间:2007-04-09

来源:互联网

<DSTree text="第一节" href="http://" target="frmright" treeId="4353" />

这个http://加内容后不能点击

现在代码很完善,但是所有的连接加上去都不能打开新页面 高手帮忙


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> DSTree </TITLE>
<META NAME="Author" CONTENT="[email protected]" >
<style>
td{font:12px verdana}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
overflow-x : hidden;
SCROLLBAR-FACE-COLOR: #fcb424;
SCROLLBAR-HIGHLIGHT-COLOR: #fcb448;
SCROLLBAR-SHADOW-COLOR: #fc9000;
SCROLLBAR-3DLIGHT-COLOR: #fc9048;
SCROLLBAR-ARROW-COLOR: #fcfcfc;
SCROLLBAR-TRACK-COLOR: #fcfcfc;
SCROLLBAR-DARKSHADOW-COLOR: #fc9000;
SCROLLBAR-BASE-COLOR: #fcfcfc
}

</style>
<script>
//code by star 20003-4-7
var HC = "color:#990000;border:1px solid #cccccc";
var SC = "background-color:#efefef;border:1px solid #cccccc;color:#000000;";
var IO = null;
function initTree(){
        var rootn = document.all.menuXML.documentElement;
        var sd = 0;
        document.onselectstart = function(){return false;}
        document.all.treeBox.appendChild(createTree(rootn,sd));
}
function createTree(thisn,sd){
        var nodeObj = document.createElement("span");
        var upobj = document.createElement("span");
        with(upobj){
                style.marginLeft = sd*10;
                className = thisn.hasChildNodes()?"hasItems":"Items";
                innerHTML = "<img src=expand.gif class=ec>" + thisn.getAttribute("text") +"";
               
                onmousedown = function(){
                        if(event.button != 1) return;
                        if(this.getAttribute("cn")){
                                this.setAttribute("open",!this.getAttribute("open"));
                                this.cn.style.display = this.getAttribute("open")?"inline":"none";
                                this.all.tags("img")[0].src = this.getAttribute("open")?"expand.gif":"contract.gif";
                        }
                        if(IO){
                                IO.runtimeStyle.cssText = "";
                                IO.setAttribute("selected",false);
                        }
                        IO = this;
                        this.setAttribute("selected",true);
                        this.runtimeStyle.cssText = SC;
                }
                onmouseover = function(){
                        if(this.getAttribute("selected"))return;
                        this.runtimeStyle.cssText = HC;
                }
                onmouseout = function(){
                        if(this.getAttribute("selected"))return;
                        this.runtimeStyle.cssText = "";
                }
                oncontextmenu = contextMenuHandle;
                onclick = clickHandle;
        }

        if(thisn.getAttribute("treeId") != null){
                upobj.setAttribute("treeId",thisn.getAttribute("treeId"));
        }
        if(thisn.getAttribute("href") != null){
                upobj.setAttribute("href",thisn.getAttribute("href"));
        }
        if(thisn.getAttribute("target") != null){
                upobj.setAttribute("target",thisn.getAttribute("target"));
        }

        nodeObj.appendChild(upobj);
        nodeObj.insertAdjacentHTML("beforeEnd","<br>")

        if(thisn.hasChildNodes()){
                var i;
                var nodes = thisn.childNodes;
                var cn = document.createElement("span");
                upobj.setAttribute("cn",cn);
                if(thisn.getAttribute("open") != null){
                        upobj.setAttribute("open",(thisn.getAttribute("open")=="true"));
                        upobj.getAttribute("cn").style.display = upobj.getAttribute("open")?"inline":"none";
                        if( !upobj.getAttribute("open"))upobj.all.tags("img")[0].src ="contract.gif";
                }
               
                for(i=0;i<nodes.length;cn.appendChild(createTree(nodes[i++],sd+1)));
                nodeObj.appendChild(cn);
        }
        else{
                upobj.all.tags("img")[0].src ="endnode.gif";
        }
        return nodeObj;
}
window.onload = initTree;
</script>

<script>
function clickHandle(){
        // your code here
}
function contextMenuHandle(){
        event.returnValue = false;
        var treeId = this.getAttribute("treeId");
        // your code here
}
</script>
</HEAD>
<BODY>
<xml id=menuXML>
<?xml version="1.0" encoding="GB2312"?>
<DSTreeRoot text="体育新课程标准" open="true" href="http://" treeId="123">
        
        <DSTree text="第一篇" open="false" treeId="">
                <DSTree text="第一章" open="false" href="http://" target="box" treeId="12">
                        <DSTree text="第一节" href="http://" target="frmright" treeId="4353" />
                        <DSTree text="第一节" href="http://" target="box" treeId="543543" />
                        <DSTree text="第一节" href="http://" target="box" treeId="543543" />
                </DSTree>
                <DSTree text="第二章" open="false" href="http://" target="box" treeId="213">
                        <DSTree text="第一节" href="http://" target="box" treeId="4353" />
                        <DSTree text="第一节" href="http://" target="box" treeId="543543" />
                </DSTree>
                <DSTree text="第三章" open="false" href="http://" target="box" treeId="432">
                        <DSTree text="第一节" href="http://" target="box" treeId="4353" />
                        <DSTree text="第一节" href="http://" target="box" treeId="543543" />
                </DSTree>
        </DSTree>

        <DSTree text="第二篇" open="false" treeId="">
                <DSTree text="第一章" open="false" href="http://" target="box" treeId="12">
                        <DSTree text="第一节" href="http://" target="box" treeId="4353" />
                        <DSTree text="第一节" href="http://" target="box" treeId="543543" />
                        <DSTree text="第一节" href="http://" target="box" treeId="543543" />
                </DSTree>
                <DSTree text="第二章" open="false" href="http://" target="box" treeId="213">
                        <DSTree text="第一节" href="http://" target="box" treeId="4353" />
                        <DSTree text="第一节" href="http://" target="box" treeId="543543" />
                </DSTree>
                <DSTree text="第三章" open="false" href="http://" target="box" treeId="432">
                        <DSTree text="第一节" href="http://" target="box" treeId="4353" />
                        <DSTree text="第一节" href="http://" target="box" treeId="543543" />
                        <DSTree text="第一节" href="" target="box" treeId="2312" />
                        <DSTree text="第一节" href="" target="box" treeId="2312" />
                </DSTree>
        </DSTree>

</DSTreeRoot>
</xml>
<table style="position:absolute;left:1px;top:17px;" width="208">
<tr><td id=treeBox style="width:194px;height:200px;border:1px padding-left:5; padding-right:3; padding-top:5; padding-bottom:3" valign=top></td></tr>
<tr><td style="font:10px verdana;color:#999999" align=right> </td></tr>
</table>

</BODY>
</HTML>

作者: fenga6   发布时间: 2007-04-09