用createPopup创建无限级菜单时,第三级菜单会把二级菜单覆盖,请各位高年指教!!

hackencn 2007-11-26 10:01:43
二级菜单没什么问题,三级菜单在显示时会把二级菜单覆盖,并且高度也不正常
...全文
119 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
hackencn 2007-11-27
  • 打赏
  • 举报
回复
发现规律是:当三级菜单比二级菜单高度高时,就会出现我所说的问题
hackencn 2007-11-27
  • 打赏
  • 举报
回复


hackencn 2007-11-27
  • 打赏
  • 举报
回复
把以上内容放在页面中,用IIS浏览,三级菜单的问题就出来了
hackencn 2007-11-27
  • 打赏
  • 举报
回复
<script language="JavaScript1.2" defer>
document.body.insertAdjacentElement("BeforeEnd",dummy);
if(document.getElementById("menuBar")!=null) {
menuBar.onclick = new Function("event.cancelBubble=true");
menuBar.onselectstart = new Function("return false");
menuBar.oncontextmenu = new Function("return false");
menuBar.style.cssText = "width:100%; border:buttonhighlight 2px outset; cursor:default; background-color:menu; line-height:16px;";
var the_row = menuBar.rows[0];
var key = "";
for(var i=0; i<the_row.cells.length; i++) {
key = the_row.cells[i].getAttribute("key");
if(key==null) key = "";
with(the_row.cells[i]) {
style.cssText = "width:80px; text-align:center; padding:0px; border:1px solid buttonface;";
onmouseenter = new Function("SetButton('enter')");
onmouseleave = new Function("SetButton('leave')");
onmouseover = new Function("if(active)showMenu(self,'"+key+"',false,'',1)");
onclick = new Function("active=!active;SetButton('enter');if(active)showMenu(self,'"+key+"',false,'',1)");
}
}
the_row.insertCell(-1);
}
var links = document.links;
for(var i=0; i<links.length; i++) {
with(links[i]) {
links[i].onclick = function() {
if(href.replace(/[\s#]/g,"")=="") return true;
flash_obj = this.parentElement;
flash_show(href, 10);
}
}
}
</script>
<table id="menuBar" align="center">
<tr>
<td key="kfgl_dy★0">Test Item</td>
<td key="news">业界动态</td>
<td key="tech">技术文档</td>
<td key="design">艺术设计</td>
<td key="photo">摄影摄像</td>
<td key="computer">计算机技术</td>
<td key="download">资源下载</td>
<td key="column">个人专栏</td>
<td key="cg">CG绘画</td>
<td><a href="http://www.blueidea.com/bbs" hidefocus>经典论坛</a></td>
</tr>
</table>

这是调菜单的地方
hackencn 2007-11-27
  • 打赏
  • 举报
回复
多发了一段,不好意思.下面是我的测试用例:

<script>
var kfgl_dy★0 = new Menu_Item();

kfgl_dy★0.Item_add('下级单位数据','','','','kfgl_dy★0_0','','');

var kfgl_dy★0_0 = new Menu_Item();
kfgl_dy★0_0.Item_add('产能建设','','','','','');
kfgl_dy★0_0.Item_add('月度报表','','','','kfgl_dy★0_0_1','','');

var kfgl_dy★0_0_1 = new Menu_Item();
kfgl_dy★0_0_1.Item_add('开发指标','/一体化/开发管理/月报/开发指标/kfzb_index.aspx','','','','');
kfgl_dy★0_0_1.Item_add('油井关井分类表','/一体化/开发管理/月报/油井关井分类表/Default_YouJingGuan.aspx','','','','');
kfgl_dy★0_0_1.Item_add('开发油田基础参数汇总表阶段数据','/一体化/开发管理/年度报表/开发油田基础参数汇总表/Default_KaiFa_jd.aspx','','','','');
kfgl_dy★0_0_1.Item_add('投产新井分类数据表阶段数据','/一体化/开发管理/月报/投产新井分类数据表/Default_TouChanFen_jd.aspx','','','','');
kfgl_dy★0_0_1.Item_add('注水井关井分类表','/一体化/开发管理/月报/注水井关井分类表/Default_ZhuShui.aspx','','','','');
kfgl_dy★0_0_1.Item_add('油田统计表','/一体化/开发管理/年度报表/油田统计表/Default_YouTian.aspx','','','','');
kfgl_dy★0_0_1.Item_add('稠油热采开发数据','/一体化/开发管理/月报/稠油热采开发数据/index.aspx','','','','');
kfgl_dy★0_0_1.Item_add('油田统计表阶段数据','/一体化/开发管理/年度报表/油田统计表/Default_YouTian_jd.aspx','','','','');
kfgl_dy★0_0_1.Item_add('投产新井分类数据表','/一体化/开发管理/月报/投产新井分类数据表/Default_TouChanFen.aspx','','','','');
kfgl_dy★0_0_1.Item_add('见水井含水情况表','/一体化/开发管理/月报/见水井含水情况表/Default_JianShui.aspx','','','','');
kfgl_dy★0_0_1.Item_add('开发油田基础参数汇总表','/一体化/开发管理/年度报表/开发油田基础参数汇总表/Default_KaiFa.aspx','','','','');
kfgl_dy★0_0_1.Item_add('注水井关井分类表阶段数据','/一体化/开发管理/月报/注水井关井分类表/Default_ZhuShui_jd.aspx','','','','');
kfgl_dy★0_0_1.Item_add('开发指标_阶段数据','/一体化/开发管理/月报/开发指标/kfzb_index1.aspx','','','','');
kfgl_dy★0_0_1.Item_add('见水井含水情况表阶段数据','/一体化/开发管理/月报/见水井含水情况表/Default_JianShui_jd.aspx','','','','');
kfgl_dy★0_0_1.Item_add('油井关井分类表阶段数据','/一体化/开发管理/月报/油井关井分类表/Default_YouJingGuan_jd.aspx','','','','');
kfgl_dy★0_0_1.Item_add('产油量构成','/一体化/开发管理/月报/产油量构成/cylgc_index.aspx','','','','');
kfgl_dy★0_0_1.Item_add('油水井动态','/一体化/开发管理/月报/油水井动态/ysjdt_index.aspx','','','','');
kfgl_dy★0_0_1.Item_add('捞油井数据阶段数据','/一体化/开发管理/月报/捞油井数据/index1.aspx','','','','');
kfgl_dy★0_0_1.Item_add('捞油井数据','/一体化/开发管理/月报/捞油井数据/index.aspx','','','','');
kfgl_dy★0_0_1.Item_add('综合开发数据','/一体化/开发管理/月报/综合开发数据/zhkfsj_index.aspx','','','','');
kfgl_dy★0_0_1.Item_add('产液量构成','/一体化/开发管理/月报/产液量构成表/cygc_index.aspx','','','','');
kfgl_dy★0_0_1.Item_add('油水井动态_阶段数据','/一体化/开发管理/月报/油水井动态/ysjdt_index1.aspx','','','','');
kfgl_dy★0_0_1.Item_add('注水构成','/一体化/开发管理/月报/注水构成/zsgc_index.aspx','','','','');
kfgl_dy★0_0_1.Item_add('综合开发数据_阶段数据','/一体化/开发管理/月报/综合开发数据/zhkfsj_index1.aspx','','','','');
kfgl_dy★0_0_1.Item_add('产油量构成_阶段数据','/一体化/开发管理/月报/产油量构成/cylgc_index1.aspx','','','','');
kfgl_dy★0_0_1.Item_add('产液量构成_阶段数据','/一体化/开发管理/月报/产液量构成表/cygc_index1.aspx','','','','');
kfgl_dy★0_0_1.Item_add('注水构成_阶段数据','/一体化/开发管理/月报/注水构成/zsgc_index1.aspx','','','','');
kfgl_dy★0_0.Item_add('年度报表','','','','','','');
kfgl_dy★0.Item_add('开发管理','','','','','');

kfgl_dy★0.Item_add('勘探管理','','','','','');

kfgl_dy★0.Item_add('天然气','','','','','');

kfgl_dy★0.Item_add('生产运行','','','','','');

kfgl_dy★0.Item_add('经营管理','','','','','');

kfgl_dy★0.Item_add('矿权储量','','','','','');

kfgl_dy★0.Item_add('节能降耗','','','','','');

kfgl_dy★0.Item_add('工程技术','','','','','');

kfgl_dy★0.Item_add('油藏经营','','','','','');
</script>
hackencn 2007-11-27
  • 打赏
  • 举报
回复
[code=JScript]
[code=JScript]
<script language="JavaScript">
var dummy = document.createElement("<div style='position:absolute; border:0px solid black; display:none; zindex:0;'></div>");
var CSStext = "border:buttonhighlight 2px outset; cursor:default; background-color: menu; text-align:left; line-height:16px; font-size: 12px;";
var flash_obj = null;
function go2url(url){
if(url.replace(/\s/g,"") == "") return;
location.href = url;
}
function flash_show(url, count) {
if(flash_obj == null) return;
flash_obj.runtimeStyle.backgroundColor = (flash_obj.runtimeStyle.backgroundColor==""?"highlight":"");
if(--count>0) {
setTimeout("flash_show('"+url+"', "+count+")", 20);
} else {
go2url(url);
flash_obj = null;
}
}
function get_Element(the_ele,the_tag){
the_tag = the_tag.toLowerCase();
if(the_ele.tagName.toLowerCase()==the_tag)return the_ele;
while(the_ele=the_ele.parentElement){
if(the_ele.tagName.toLowerCase()==the_tag)return the_ele;
}
return(null);
}
function High_Low_light(e,mode){
var the_tbl = get_Element(e.srcElement,"table");
for(var i=0; i<the_tbl.rows.length; i++) {
the_tbl.rows[i].runtimeStyle.cssText ="";
}
var the_tr = get_Element(e.srcElement,"tr");
if(the_tr!=null){
if(the_tr.innerText=="") return;
the_tr.runtimeStyle.backgroundColor = mode?"highlight":"";
the_tr.runtimeStyle.color = mode?"white":"";
}
}
function showMenu(win,the_Menu,ifSub,title,mode,wait){
e = win.event;
window.status = the_Menu;
if(mode!=1) {
var the_tr = get_Element(e.srcElement,"tr");
if(the_tr==null) return;
}
if(the_Menu=="" || the_Menu==null) {
popMenu = win.document.parentWindow.createPopup();
popMenu.document.body.innerHTML = "";
popMenu.show(0, 0, 0, 0);
return;
} else {
the_Menu = eval("top."+the_Menu);
}
if(typeof(the_Menu) == "undefined") {
popMenu = win.document.parentWindow.createPopup();
popMenu.document.body.innerHTML = "";
popMenu.show(0, 0, 0, 0);
return;
}
if(the_Menu.popMenu==null){
the_Menu.popMenu = win.document.parentWindow.createPopup();
the_Menu.Menu_build();
the_Menu.popMenu.document.body.innerHTML = the_Menu.Menu_content;
the_Menu.popMenu.document.body.onselectstart = new Function("return false");
the_Menu.ifSubMenu = ifSub?true:false;
} else {
if(the_Menu.popMenu.isOpen) return;
the_Menu.popMenu.document.body.innerHTML = the_Menu.Menu_content;
}
var the_obj = null;
var the_top = 0;
var the_left = 0;
dummy.innerHTML = the_Menu.Menu_content;
dummy.style.display = "";
var the_width = dummy.offsetWidth;
var the_height = dummy.offsetHeight;
dummy.style.display = "none";
if(the_Menu.ifSubMenu){
the_obj = the_tr;
the_top = -2;
the_left = win.document.parentWindow.document.body.offsetWidth - 5;
}else{
the_obj = e.srcElement;
the_top = mode?the_obj.offsetHeight+2:0;
the_left = mode?0:the_obj.offsetWidth;
}
if(the_left+the_width+e.screenX>screen.width && mode!=1) {
the_left = -the_width;
}
the_Menu.popMenu.show(the_left, the_top, the_width, the_height, the_obj);
}
function Menu_Item(){
this.Item_list = new Array();
this.Menu_content = "";
this.Item_add = function(txt,link,title,img,subMenu,aKey,hotKey){
if(txt==undefined || txt.replace(/\s/g,"")=="") txt = "";
if(link==undefined || link.replace(/\s/g,"")=="") link = "###";
if(title==undefined || title.replace(/\s/g,"")=="") title = "";
if(img==undefined || img.replace(/\s/g,"")=="") img = false;
if(subMenu==undefined || subMenu.replace(/\s/g,"")=="") subMenu = "";
if(aKey==undefined || !/^[a-zA-Z]{1}$/.test(aKey)) aKey = "";
if(hotKey==undefined || hotKey.replace(/\s/g,"")=="") hotKey = "";
this.Item_list.push([txt,link,title,img,subMenu,aKey.toUpperCase(),hotKey.toUpperCase()]);
}
this.Menu_build = function(){
var tmp = null;
this.Menu_content = "";
this.Menu_content += "<table id='main_tbl' border=0 cellSpacing=0 cellPadding=0 style='"+CSStext+"' onmouseover='top.High_Low_light(event,1)'>\n";
for(var i=0;i<this.Item_list.length;i++){
cur_item = this.Item_list[i];
if(cur_item[0]=="") {
this.Menu_content += "<tr><td colspan='4'><hr></td></tr>\n";
} else {
this.Menu_content += "<tr onmouseover=\"top.showMenu(self,'"+cur_item[4]+"',true,'"+cur_item[2]+"')\" onmouseout=\"top.status=''\" onclick=\"if('"+cur_item[1]+"'!='###'){top.flash_obj=this;top.flash_show('"+cur_item[1]+"', 10)}else{top.showMenu(self,'"+cur_item[4]+"',true,'"+cur_item[2]+"')}\">\n";
this.Menu_content += "<td style='padding:3px'>"+(cur_item[3]?"<img border=0 width=16 height=16 src="+cur_item[3]+">":" ")+"</td>\n";
this.Menu_content += "<td style='padding:3px'>"+cur_item[0]+(cur_item[5]==""?"":("(<u>"+cur_item[5]+"</u>)"))+"</td>\n";
this.Menu_content += "<td style='padding:3px;padding-left:10px;text-align:right'>"+(cur_item[6]==""?"":cur_item[6])+"</td>\n";
this.Menu_content += "<td style='padding:3px;font-size:7px'>" + (cur_item[4]!=""?"►":"  ") +"</td></tr>\n";
}
}
this.Menu_content += "</table>\n";
//alert(this.Menu_content)
}
this.popMenu = null;
this.ifSubMenu = false;
}
//-----test:start------//
function do_something(){
alert("Coded by windy_sk !");
}


<script language="JavaScript">
var dummy = document.createElement("<div style='position:absolute; border:0px solid black; display:none; zindex:0;'></div>");
var CSStext = "border:buttonhighlight 2px outset; cursor:default; background-color: menu; text-align:left; line-height:16px; font-size: 12px;";
var flash_obj = null;
function go2url(url){
if(url.replace(/\s/g,"") == "") return;
location.href = url;
}
function flash_show(url, count) {
if(flash_obj == null) return;
flash_obj.runtimeStyle.backgroundColor = (flash_obj.runtimeStyle.backgroundColor==""?"highlight":"");
if(--count>0) {
setTimeout("flash_show('"+url+"', "+count+")", 20);
} else {
go2url(url);
flash_obj = null;
}
}
function get_Element(the_ele,the_tag){
the_tag = the_tag.toLowerCase();
if(the_ele.tagName.toLowerCase()==the_tag)return the_ele;
while(the_ele=the_ele.parentElement){
if(the_ele.tagName.toLowerCase()==the_tag)return the_ele;
}
return(null);
}
function High_Low_light(e,mode){
var the_tbl = get_Element(e.srcElement,"table");
for(var i=0; i<the_tbl.rows.length; i++) {
the_tbl.rows[i].runtimeStyle.cssText ="";
}
var the_tr = get_Element(e.srcElement,"tr");
if(the_tr!=null){
if(the_tr.innerText=="") return;
the_tr.runtimeStyle.backgroundColor = mode?"highlight":"";
the_tr.runtimeStyle.color = mode?"white":"";
}
}
//这是我在网上找到的程序,用我的测试菜单也存在我说的问题这是我在网上找到的程序,用我的测试菜单也存在我说的问题
hztgcl1986 2007-11-27
  • 打赏
  • 举报
回复

http://blog.csdn.net/hztgcl1986/archive/2007/11/20/1894852.aspx
N级联动菜单





[img=http://imgcache.qq.com/qzone_v4/client/userinfo_icon/3003.gif]

[/img]
hackencn 2007-11-27
  • 打赏
  • 举报
回复
主要问题是,我如果直接用IE打开网页,页面的菜单是能正确显示的,如果能过IIS浏览,就会出现上面说的
xiaolei1982 2007-11-26
  • 打赏
  • 举报
回复
我给你个好用的例子,自己下载看看
http://webuc.net/dotey/archive/2004/06/30/1117.aspx
zsm139 2007-11-26
  • 打赏
  • 举报
回复
你最好把代码发过来看看,就这样不知道你的情况和问题

87,992

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧