资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
写了个XML+Tree无穷树js版
<head> <style type="text/css"> .select { width:80%; border:0px solid #bfbfbf; } .options { width:98%; border:0px solid #ff0000; } .tree { width:92%; border:0px solid #ff0000; } </style> </head> <body> <xml id="Login"> <?xml version="1.0" encoding="utf-8" ?> <Students name="98班级"> <Student name="王小平"> <Chinese id="語文"> <Item id="单选题"> <Score id="33"></Score> <Score id="33"></Score> <Score id="33"></Score> </Item> <Item id="多选题"> <Score id="33"></Score> </Item> <Item id="计算题"> <Score id="33"></Score> </Item> <Item id="应用题"> <Score id="33"></Score> </Item> <Item id="附加题"> <Score id="33"></Score> </Item> </Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="王小波"> <Chinese id="語文"> <Item id="单选题"> <Score id="33"></Score> <Score id="33"></Score> <Score id="33"></Score> </Item> <Item id="多选题"> <Score id="33"></Score> </Item> <Item id="计算题"> <Score id="33"></Score> </Item> <Item id="应用题"> <Score id="33"></Score> </Item> <Item id="附加题"> <Score id="33"></Score> </Item> </Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="劉瓊"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="孟雲江"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="余敬興"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="金細愛"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="羅必洪"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="姜海平"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="姚軍"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="李海濤"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="陳平"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="胡光"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> </Students> </xml> <body> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%3E%20%0D%0A%2F%2F%20%0D%0Avar%20Box%20%3D%20function%20()%20%0D%0A%7B%20%0D%0A%20%20%20%20return%20document.createElement(%22div%22)%3B%20%0D%0A%7D%20%0D%0A%2F%2F%20%0D%0A%2F%2F%20%0D%0Avar%20desktop%20%3D%20document.body%3B%20%0D%0A%2F%2F%20%0D%0A%2F%2F%20%0D%0A%2F%2F%20%0D%0Avar%20Options%20%3D%20function%20()%20%0D%0A%7B%20%0D%0A%20%20%20%20%2F%2F%20%0D%0A%7D%20%0D%0Avar%20Tree%20%3D%20function%20()%20%0D%0A%7B%20%0D%0A%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20var%20_this%20%3D%20this%3B%20%0D%0A%20%20%20%20this._select%20%3D%20null%3B%20%0D%0A%20%20%20%20this._options%20%3D%20null%3B%20%0D%0A%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20this.create%20%3D%20function%20(level%2Cxml)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20var%20space%20%3D%20%22%22%3B%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%3D0%3Bi%3Clevel%3Bi%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20space%20%2B%3D%20%22%26nbsp%3B%26nbsp%3B%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20this._select%20%3D%20new%20Box()%3B%20%0D%0A%20%20%20%20%20%20%20%20this.appendChild(this._select)%3B%20%0D%0A%20%20%20%20%20%20%20%20this._select.className%20%3D%20%22select%22%3B%20%0D%0A%20%20%20%20%20%20%20%20this._select.innerHTML%20%3D%20space%2B%22%5B%2B%5D%22%2Bxml.attributes%5B0%5D.value%3B%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20this._options%20%3D%20new%20Box()%3B%20%0D%0A%20%20%20%20%20%20%20%20this.appendChild(this._options)%3B%20%0D%0A%20%20%20%20%20%20%20%20this._options.className%20%3D%20%22options%22%3B%20%0D%0A%2F%2F%20%20%20%20%20%20%20%20this._options.innerHTML%20%3D%20%22options%22%3B%20%0D%0A%20%20%20%20%20%20%20%20this._options.style.display%20%3D%20%22inline%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20this._select.onclick%20%3D%20function%20()%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(_this._options.style.display%20%3D%3D%20%22inline%22)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20_this._options.style.display%20%3D%20%22none%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20else%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20_this._options.style.display%20%3D%20%22inline%22%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%3D0%3Bi%3C%20xml.childNodes.length%3Bi%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(xml.childNodes%5Bi%5D.childNodes.length%3E0)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._tree%20%3D%20new%20Box()%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._options.appendChild(this._tree)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._tree.style.display%20%3D%20%22inline%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Tree.apply(this._tree)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._tree.className%20%3D%20%22tree%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._tree.create(level%2B1%2Cxml.childNodes%5Bi%5D)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20else%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20div%20%3D%20new%20Box()%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._options.appendChild(div)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20div.innerHTML%20%3D%20space%2B%22%26nbsp%3B%26nbsp%3B%22%2B%22%5B-%5D%22%2Bxml.childNodes%5Bi%5D.attributes%5B0%5D.value%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0A%2F%2F%20%0D%0Avar%20tree%20%3D%20new%20Box()%3B%20%0D%0Adesktop.appendChild(tree)%3B%20%0D%0ATree.apply(tree)%3B%20%0D%0Atree.className%20%3D%20%22tree%22%3B%20%0D%0Atree.style.left%20%3D%20400%3B%20%0D%0Atree.create(0%2CLogin.documentElement)%3B%20%0D%0A%3C%2Fscript%3E">
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
<head> <style type="text/css"> .select { width:80%; border:0px solid #bfbfbf; } .options { width:98%; border:0px solid #ff0000; } .tree { border:0x solid #ff0000; } .treeView { height:400px; width:300px; border:1x solid #ff0000; overflow:auto; } </style> </head> <body> <xml id="Login"> <?xml version="1.0" encoding="utf-8" ?> <Students name="98班级"> <Student name="王小平"> <Chinese id="語文"> <Item id="单选题"> <Score id="33"></Score> <Score id="33"></Score> <Score id="33"></Score> </Item> <Item id="多选题"> <Score id="33"></Score> </Item> <Item id="计算题"> <Score id="33"></Score> </Item> <Item id="应用题"> <Score id="33"></Score> </Item> <Item id="附加题"> <Score id="33"></Score> </Item> </Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="王小波"> <Chinese id="語文"> <Item id="单选题"> <Score id="33"></Score> <Score id="33"></Score> <Score id="33"></Score> </Item> <Item id="多选题"> <Score id="33"></Score> </Item> <Item id="计算题"> <Score id="33"></Score> </Item> <Item id="应用题"> <Score id="33"></Score> </Item> <Item id="附加题"> <Score id="33"></Score> </Item> </Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="劉瓊"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="孟雲江"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="余敬興"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="金細愛"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="羅必洪"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="姜海平"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="姚軍"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="李海濤"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="陳平"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> <Student name="胡光"> <Chinese id="語文"></Chinese> <Physics id="物理"></Physics> <English id="英語"></English> <Geography id="地理"></Geography> <Historical id="歷史"></Historical> </Student> </Students> </xml> <body> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%3E%20%0D%0A%2F%2F%20%0D%0Avar%20Box%20%3D%20function%20()%20%0D%0A%7B%20%0D%0A%20%20%20%20return%20document.createElement(%22div%22)%3B%20%0D%0A%7D%20%0D%0A%2F%2F%20%0D%0A%2F%2F%20%0D%0Avar%20desktop%20%3D%20document.body%3B%20%0D%0A%2F%2F%20%0D%0A%2F%2F%20%0D%0A%2F%2F%20%0D%0Avar%20Options%20%3D%20function%20()%20%0D%0A%7B%20%0D%0A%20%20%20%20%2F%2F%20%0D%0A%7D%20%0D%0Avar%20Tree%20%3D%20function%20()%20%0D%0A%7B%20%0D%0A%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20var%20_this%20%3D%20this%3B%20%0D%0A%20%20%20%20this._select%20%3D%20null%3B%20%0D%0A%20%20%20%20this._options%20%3D%20null%3B%20%0D%0A%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20this.create%20%3D%20function%20(level%2Cxml)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20var%20space%20%3D%20%22%22%3B%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%3D0%3Bi%3Clevel%3Bi%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20space%20%2B%3D%20%22%26nbsp%3B%26nbsp%3B%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20this._select%20%3D%20new%20Box()%3B%20%0D%0A%20%20%20%20%20%20%20%20this.appendChild(this._select)%3B%20%0D%0A%20%20%20%20%20%20%20%20this._select.className%20%3D%20%22select%22%3B%20%0D%0A%20%20%20%20%20%20%20%20this._select.innerHTML%20%3D%20space%2B%22%5B%2B%5D%22%2Bxml.attributes%5B0%5D.value%3B%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20this._options%20%3D%20new%20Box()%3B%20%0D%0A%20%20%20%20%20%20%20%20this.appendChild(this._options)%3B%20%0D%0A%20%20%20%20%20%20%20%20this._options.className%20%3D%20%22options%22%3B%20%0D%0A%2F%2F%20%20%20%20%20%20%20%20this._options.innerHTML%20%3D%20%22options%22%3B%20%0D%0A%20%20%20%20%20%20%20%20this._options.style.display%20%3D%20%22inline%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20this._select.onclick%20%3D%20function%20()%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(_this._options.style.display%20%3D%3D%20%22inline%22)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20_this._options.style.display%20%3D%20%22none%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20else%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20_this._options.style.display%20%3D%20%22inline%22%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%3D0%3Bi%3C%20xml.childNodes.length%3Bi%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(xml.childNodes%5Bi%5D.childNodes.length%3E0)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._tree%20%3D%20new%20Box()%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._options.appendChild(this._tree)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._tree.style.display%20%3D%20%22inline%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Tree.apply(this._tree)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._tree.className%20%3D%20%22tree%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._tree.create(level%2B1%2Cxml.childNodes%5Bi%5D)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20else%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20div%20%3D%20new%20Box()%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this._options.appendChild(div)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20div.innerHTML%20%3D%20space%2B%22%26nbsp%3B%26nbsp%3B%22%2B%22%5B-%5D%22%2Bxml.childNodes%5Bi%5D.attributes%5B0%5D.value%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%2F%2F%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0A%2F%2F%20%0D%0Avar%20tree%20%3D%20new%20Box()%3B%20%0D%0Adesktop.appendChild(tree)%3B%20%0D%0ATree.apply(tree)%3B%20%0D%0Atree.className%20%3D%20%22treeView%22%3B%20%0D%0Atree.style.left%20%3D%20400%3B%20%0D%0Atree.create(0%2CLogin.documentElement)%3B%20%0D%0A%2F%2F%20%0D%0Avar%20tree1%20%3D%20new%20Box()%3B%20%0D%0Adesktop.appendChild(tree1)%3B%20%0D%0ATree.apply(tree1)%3B%20%0D%0Atree1.className%20%3D%20%22treeView%22%3B%20%0D%0Atree1.style.position%20%3D%20%22absolute%22%3B%20%0D%0Atree1.style.top%20%3D%20100%3B%20%0D%0Atree1.style.left%20%3D%20400%3B%20%0D%0Atree1.create(0%2CLogin.documentElement)%3B%20%0D%0A%2F%2F%20%0D%0A%3C%2Fscript%3E">
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程