网页菜单显示问题

fred_guo_xf 2018-01-18 04:52:36
最近做了个网站,在自己电脑菜单显示正常,但是IIS发布后,别人电脑登录网站,子菜单点开会跟父菜单叠在一起,不知道哪里出问题了。如下代码:
this.showMenu = function(x,y,w){

var h = 0;
if ( this.popup != null && this.popup != "null" ){
if ( !this.popup.isOpen ){
try{
this.currentMenuItem.showNormal()
}catch(e){};
w = menuPosition[0];
h = menuPosition[1];
this.popup.show(x, y, w, h,document.body);
}
return;
}
var d = this.getMeasureDiv();
var t0 = new Date().getTime();
h = d.firstChild.offsetHeight;
//window.status += "菜单耗时:"+(new Date().getTime() - t0);
w = d.firstChild.offsetWidth;

this.getPopup();
var oPopupBody = this.popup.document.body;
this.popup.document.createStyleSheet(MenuBar.cssSrc);

if ( this.parentMenu !=null && this.parentMenu.getEl().className == "MenuRootActive" )
oPopupHtml = d.innerHTML +"<DIV class=\"MenuRootModify\" style=\" WIDTH: "+ (this.parentMenu.getEl().offsetWidth-2) +"; \"></DIV>";
else
oPopupHtml = d.innerHTML;
d.innerHTML = "";
oPopupBody.innerHTML = oPopupHtml;
oPopupBody.firstChild.style.visibility = "visible";
this._document = this.popup.document;
// try{
// this._showTimer = window.setTimeout(
// new Function("eventListeners.onshowtimer(\"" + this.id + "\",\""+x+"\",\""+y+"\",\""+w+"\",\""+h+"\")" ),
// window.menuBar1.showTimeout );
// }
// catch(e){
this.popup.show(x, y, w, h,document.body);
// }

menuPosition[0]=w;
menuPosition[1]=h;
this.menuState = true ;

this.AddEvent();

}
this.showSubMenu = function(){
// var x = getTrElement(this.parentMenu.getWindow().event.srcElement).offsetWidth-1;
var x = getTrElement(this.parentMenu.getWindow().event.srcElement).offsetLeft + getTrElement(this.parentMenu.getWindow().event.srcElement).offsetWidth-1
var y = getTrElement(this.parentMenu.getWindow().event.srcElement).offsetTop-2;
var w ;
this.parentMenu.currentSubMenu = this ;
if (this.parentMenu.currentSubMenu != null) {
this.parentMenu.subMenuState = true ;
}
this.showMenu(x, y, w);
}
this.AddEvent = function(){
var tb = this.element = this._document.getElementById(this.id);
with (this._document){
attachEvent("onmouseover",new Function ("eventListeners.Menu.onmouseover('"+this.id+"')"));
attachEvent("onmouseout",new Function ("eventListeners.Menu.onmouseout('"+this.id+"')"));
attachEvent("onclick",new Function ("eventListeners.Menu.onclick('"+this.id+"')"));
attachEvent("oncontextmenu",new Function ("eventListeners.oncontextmenu('"+this.id+"')"));
attachEvent("onselectstart",new Function ("eventListeners.onselectstart('"+this.id+"')"));

}
window.attachEvent("onunload",new Function ("eventListeners.Menu.onunload('"+this.id+"')"));
}
...全文
722 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
yaotomo 2018-01-23
  • 打赏
  • 举报
回复
看看是不是浏览器不兼容造成的 你和别人用的IE版本一样吗? 除了IE内核的浏览器,兼容性问题很少的

87,910

社区成员

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

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