只了解一点 ASP,请这里的高手帮帮忙了
<html> <body> <%@ LANGUAGE="JScript"%>
<% var path = Server.Mappath("tree.xml");
var tag= Request.QueryString("tag");
gen_menu();
function gen_menu() { var xmldom = new ActiveXObject("Msxml.DOMDocument"); xmldom.async=false; if(false==xmldom.load(path)) { Response.Write("alert('xml file is invalid')");return; } var parent_node; if(tag=="null") { parent_node = xmldom.selectSingleNode("//All_Nodes"); } else { parent_node = xmldom.selectSingleNode("//node[@id=" + parseInt(tag) + "]"); } var ret_node = xmldom.createElement('parent_node'); for(var i=0;i<parent_node.childNodes.length;i++) { var node = parent_node.childNodes.item(i); var t_node = node.cloneNode(false); t_node.setAttribute('has_child',(node.hasChildNodes()?'true':'false')); t_node.setAttribute('tag',t_node.getAttribute('id'));//use id as tag value t_node.removeAttribute('id'); ret_node.appendChild(t_node); } Response.Write(ret_node.xml); } %>
<script> parent.tree.load_doc(document); </script>
</body> </html>