日期:2014-05-17 浏览次数:20477 次
// JScript 文件 $(function (){ $.ajax({ type:"GET", url:"GetTree.aspx", datatype:"html", success:function(data){ $(data).find("SysFun").each(function(i){ var id=$(this).children("NodeId"); //取对象 var id_value=$(this).children("NodeId").text(); //取文本 或者 $("id" , xml).text(); var ParentNodeId=$(this).children("ParentNodeId"); var ParentNodeId_value=$(this).children("ParentNodeId").text(); var DisplayName=$(this).children("DisplayName"); var DisplayName_value=$(this).children("DisplayName").text(); var NodeURL=$(this).children("NodeURL"); var NodeURL_value=$(this).children("NodeURL").text(); var DisplayOrder=$(this).children("DisplayOrder"); var DisplayOrder_value=$(this).children("DisplayOrder").text(); var ImgURL=$(this).children("ImgURL"); var ImgURL_value=$(this).children("ImgURL").text(); var IsLeaf=$(this).children("IsLeaf"); var IsLeaf_value=$(this).children("IsLeaf").text(); if(ParentNodeId_value=="0"){ var divlist=$("<div id="+id_value+" class='parent'></div>"); var im=$("<img src='../Images/s.gif'/>"); var title=$("<div class='title'>"+DisplayName_value+"</div>"); var head=$("<div class='head'></div>"); if(DisplayOrder_value=="1") { var nr=$("<div class='nr' style='display:block'><ul id='"+id_value+"nr' style='margin:0px;padding-top:12px;padding-left:0px'></ul></div>"); var icon=$("<div class='icon'></div>"); icon.css("background-position","0px -255px"); head.append(icon); head.append(im); head.append(title); divlist.append(head); nr.css("height",$(window).height()-105).appendTo(divlist); } else { var nr=$("<div class='nr'><ul id='"+id_value+"nr' style='margin:0px;padding-top:12px;padding-left:0px'></ul></div>"); var icon=$("<div class='icon'></div>"); head.append(icon); head.append(im); head.append(title); divlist.append(head); divlist.append(head); divlist.append(nr); } $("#middle").append(divlist); } else { var li=$("<li style='list-style-type:none;width:180px;height:24px;padding-bottom:5px'></li>"); var img=$("<img src='../Images/"+ImgURL_value+"' width='16' height='16' style='float:left;margin-left:30px;margin-right:4px;margin-top:4px;' />"); var span=$("<span style='float:left;margin-top:5px'>"+DisplayName_value+"</span>"); li.append(img); li.append(span); $("#"+ParentNodeId_value+"nr").append(li); } } ); } }); })
using System