用js动态构成菜单怎么做? 用js构成一个菜单,菜单文本从数据库里读取,具体怎么做?还有,用js怎么接收从后台代码中返回的一个泛型集合?谢谢大家,分不多了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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); } }}就是这段代码,在ie6里面有的菜单项没有数据 http://www.gyb369.com/Pros.aspx?type=li4就是这个地址,左边菜单项有问题,在ie6下有的菜单项没有数据,在其他浏览器里能看到 $(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()); 【求助】一个图片切换功能的代码怎么实现有效果切换呢? dsoFramer.ocx控件 求一段jquery的js代码 JavaScript 无刷新 联动 日期 大家帮忙 100分请教高手,问题解决马上结。关于日期控件问题! js中给如当前日期,如何取得后一天的日期 菜鸟求教,下面这个页面错在哪里阿??想实现用一个函数使本页面跳到另一个页面 为什么页面中的IsNumber()函数老出错? 怎么实现百度移动端首页限制划动的效果? jquery 下 文本框内容选中效果 怎样用js控制iframe的高度
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);
}
}
}
就是这段代码,在ie6里面有的菜单项没有数据
$(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());