csdn 左侧树型列表的实现原理是怎么的???请大家参与讨论

解决方案 »

  1.   


        <meta content="http://community.csdn.net/tree/f.r.huang(meizz梅花雪)//www.meizz.com" name="author">
        <script language="javascript" src="http://community.csdn.net/tree/mztreeview10.js"></script>
        <script language="javascript" src="http://community.csdn.net/tree/TreeNodeData/begin.js"></script> <script language="javascript">
        <!--
        var tree = new MzTreeView("tree");
        tree.setIconPath("http://community.csdn.net/Tree/TreeImages/");
        tree.url = "http://community.csdn.net/Expert/ForumList.asp?typenum=1";
        tree.target = "ContentFrame";
        tree.nodeFilePath = "http://community.csdn.net/Tree/TreeNodeData/";
        InitShowTreeInfo(tree);
        document.getElementById('treeviewarea').innerHTML = tree.toString();
        //-->
        </script>
      

  2.   

    原理: 
    this.XMLHttpLoadFile = function(url,id) 
        {
            var httpRequest;
            if (typeof XMLHttpRequest != 'undefined') {
                httpRequest = new XMLHttpRequest();
            }
            else if (typeof ActiveXObject != 'undefined') {
                httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
            }
            if (httpRequest) {
                httpRequest.open('GET', url, false);
                httpRequest.send(null);
                if(httpRequest.status == 200)
                {
                    var textInfo = httpRequest.responseText;
                    eval(textInfo);
                }
            }
        }
    即时读取并, 解析javascript脚本