87,990
社区成员
发帖
与我相关
我的任务
分享
$(document).ready(function () {
$.ajax(
{
type: "GET",
url: "Menu_Handlert.aspx?Method=Getmenu",
data: { PageType: "GetPersonList" }, //anticache: Math.floor(Math.random() * 1000),
beforeSend: function () { $("#treediv").html("<center><img src='Img/loading.gif' />menu is loading...</center>"); },
success: function (data) {
$("#treediv").html(data);//返回的内容
},
error: function () { $("#treediv").html("加载错误"); }
});
});
// js菜单 代码
//从数据库取得数据
StringBuilder sb = new StringBuilder();
sb.Append(@" <div align='center'>
<div id='my_menu' class='sdmenu'> ");
//get root node
...
Response.Write(sb.ToString());
function funReady(result) {
for (var i = 0; i < result.length; i++) {
var parentname = result[i];
var parentid = document.getElementById('MenuContainer');
var p = document.createElement('h4');
p.id = i + "h4";
var listpc = result[i].split('|');
p.innerHTML = listpc[0];
var hid = p.id;
//p.attachEvent("onclick", newopen(hid));
parentid.appendChild(p);
var div = document.createElement('div');
div.id = hid + "div";
div.style.display = "none";
div.attachEvent("onmouseleave", divmouseout(div.id));
// div.attachEvent("onmouseenter", newTypeover(div.id));
// div.attachEvent("onmouseout", divmouseout(div.id)); onmouseleave
var listchild = listpc[1].split(',');
if (listchild.length == 1) {
if (listchild[0] == "0") {//没有子节点
p.innerHTML = '<a href=Pros.aspx?type=li4&ParentType=' + listpc[0] + '>' + listpc[0] + '</a>';
continue;
}
}
//p.attachEvent("onclick", newopen(hid));onmouseover
p.attachEvent("onmouseenter", newover(hid));
for (var j = 0; j < listchild.length; j++) {
var childp = document.createElement('div');
childp.innerHTML = '<a id=bbbb href=Pros.aspx?type=li4&ChildType=' + listchild[j] + '>' + listchild[j] + '</a>';
childp.id = "aaa";
childp.attachEvent("onmouseleave", divchildmouseout);
div.appendChild(childp);
parentid.appendChild(div);
}
}
}