当前位置 > 首页 > IE9\IE8

Probleme mit DropDown-Menü seit IE 9

2012-4-26 23:01:00来源:IE9\IE8

Hallo,

Ich habe auf einer Seite folgenden Quellcode:

function webClient() {

  var i;

  this.IE    = false;
  this.NS    = false;
  this.OP    = false; 
  this.release = null;
  
  if ((i = navigator.userAgent.indexOf("Opera")) >= 0) {
    this.OP = true;
    this.version = parseFloat(navigator.userAgent.substr(i + 5));
    return;
  }

  
  if ((i = navigator.userAgent.indexOf("MSIE")) >= 0) {
    this.IE = true;
    this.release = parseFloat(navigator.userAgent.substr(i + 4));
    return;
  }

  if ((i = navigator.userAgent.indexOf("Netscape6/")) >= 0) {
    this.NS = true;
    this.release = parseFloat(navigator.userAgent.substr(i + 10));
    return;
  }

  if ((i = navigator.userAgent.indexOf("Netscape7/")) >= 0) {
    this.NS = true;
    this.release = parseFloat(navigator.userAgent.substr(i + 10));
    return;
  }

  if ((i = navigator.userAgent.indexOf("Gecko")) >= 0) {
    this.NS = true;
    this.release = 6.1;
    return;
  }
}


var webClient = new webClient();

var activeButton = null;
var activeSubButton = null;

 if (webClient.IE)
	 document.onmousedown = pageMouseDown;
  else
     document.addEventListener("mousedown", pageMouseDown, true);

function pageMouseDown(event) {

  var el;
  
  //if (activeButton == null)
  //  return;

  if (webClient.IE)
    el = window.event.srcElement;
  else
    el = (event.target.tagName ? event.target : event.target.parentNode);

  if (el == activeButton || el == activeSubButton)
    return;

  if (el.className != "menuButton"  && el.className != "menuItem" &&
      el.className != "menuItemSep" && el.className != "menu") {
	    if (activeButton) closeMenu(activeButton);
    	if (activeSubButton) closeSubMenu(activeSubButton);
	}
}

function menuTouch(event, menuName) {
  var button;
  if (webClient.IE)
    button = window.event.srcElement;
  else
    button = (event.target.tagName ? event.target : event.target.parentNode);

  if (!button.menu && menuName)
    button.menu = document.getElementById(menuName);

  if (activeButton && activeButton != button)
    closeMenu(activeButton);
  if (activeSubButton && activeSubButton != button)
    closeSubMenu(activeSubButton);
	
  if (!button.isactive)
  	if (menuName) {
	    openMenu(button);
	//} else {
	//	activeButton=button;
	//	button.isactive=true;
	//	button.className = "menuButtonActive";
	}
  return false;
}

function subMenuTouch(event, menuName) {
  var button;

  if (webClient.IE)
    button = window.event.srcElement;
  else
    button = (event.target.tagName ? event.target : event.target.parentNode);

  if (!button.menu && menuName)
    button.menu = document.getElementById(menuName);

  if (activeSubButton && activeSubButton != button)
    closeSubMenu(activeSubButton);

  if (!button.isactive && menuName)
    openSubMenu(button);

  return false;
}

function openSubMenu(button) {

  var w, dw, x, y;

  button.className = "menuItemActive";  
  
  if (webClient.IE && !button.menu.firstChild.style.width) {
    w = button.menu.firstChild.offsetWidth;
    button.menu.firstChild.style.width = w + "px";
    dw = button.menu.firstChild.offsetWidth - w;
    w -= dw;
    button.menu.firstChild.style.width = w + "px";
  }

  x = getPageOffsetLeft(button)+ button.offsetWidth;;
  y = getPageOffsetTop(button);

  x++;
  y++;
  
  button.menu.style.left = x + "px";
  button.menu.style.top  = y + "px";
  button.menu.style.visibility = "visible";

  button.isactive = true;
  activeSubButton = button;
}

function openMenu(button) {

  var w, dw, x, y;

  button.className = "menuButtonActive";

  if (webClient.IE && !button.menu.firstChild.style.width) {
    w = button.menu.firstChild.offsetWidth;
    button.menu.firstChild.style.width = w + "px";
    dw = button.menu.firstChild.offsetWidth - w;
    w -= dw;
    button.menu.firstChild.style.width = w + "px";
  }

  x = getPageOffsetLeft(button)-1;  

  y = getPageOffsetTop(button) + button.offsetHeight;

  button.menu.style.left = x + "px";
  button.menu.style.top  = y + "px";
  button.menu.style.visibility = "visible";

  button.isactive = true;
  activeButton = button;
}

function closeMenu(button) {
  button.className = "menuButton";

  if (button.menu) button.menu.style.visibility = "hidden";

  button.isactive = false;
  activeButton = null;
}

function closeSubMenu(button) {
  button.className = "menuItem";

  if (button.menu) button.menu.style.visibility = "hidden";

  button.isactive = false;
  activeSubButton = null;
}


function getPageOffsetLeft(el) {
  return el.offsetLeft + (el.offsetParent ? getPageOffsetLeft(el.offsetParent) : 0);
}

function getPageOffsetTop(el) {
  return el.offsetTop + (el.offsetParent ? getPageOffsetTop(el.offsetParent) : 0);
}

Leider funktioniert jetzt seit Internet Explorer 9 das DropDown-Menü nicht mehr.

Hat jemand eine Idee an was das liegen k?nnte und was ich ?ndern muss?

VIELEN DANK schon mal!!

Gru?

Matthias



  • IE9正式版在js中调用appendChild时的问题

    2011-3-19 17:58:00

    页面test1.html <HTML> <HEAD><TITLE></TITLE> </HEAD> <body> &

  • IE9网站锁定问题

    2011-9-20 17:48:00

    目前似乎都是拖动图标或者网页内提示拖动图标来锁定到任务栏,有没有代码可以直接实现点击弹出确认框来直接锁定网站到任务栏而不是拖动的方式?

  • IE stürzt ab

    2011-12-18 3:35:00

    Hallo zusammen, in letzter Zeit passiert es häufiger,dass mein IE sich einfach mitten im Bet

  • IE9工行u盾问题!请赐教@!@

    2011-3-21 12:46:00

    我用ie9在淘宝登陆网银付款时,ie9下面总提示要运行加载项我点允许后一直没反应!(试过很多次)如果按f12换成ie8模式就能检测到u盾。 但是,我以前用ie9(ie9模式)在非淘宝网站购物时又可

  • The Password is being keyed, briefly display the last character before masking it as an asterisk (*) a bullet point (?)

    2012-5-3 14:37:00

    Hi, I am doing the mobile Web Application in MVC3 Razor. I am new to the MVC3.In my login page

  • IE 9打开优酷视频网页时无法加载视频

    2011-3-19 23:04:00

    经常去优酷,但这两天发现IE 9在进入视频播放页时无法加载视频,但是优酷首页的不用打开页面的视频可直接点击播放,具体情况如下图 这样的可以直接点播放键播放 但是进入网页后就不能加

  • 升级为IE9,,同一分区根目录下出现两个同名的“收藏夹”

    2011-3-22 12:43:00

    在升级为IE9前,已将“收藏夹”移到E:\.升级为IE9后,同一盘符E:\中出现两个同名的“收藏夹”,如图: 属性选项卡不同,而且,第二个收藏夹为空的。

  • win7 sp1装了IE9后无法恢复到IE8

    2011-3-20 19:29:00

    看到很多TX都说IE9卸载后就直接是IE8了,我卸载后重启,遇到IENONCE.dll错误,然后也没有恢复到IE8,现在连IE都没了,连设备管理器打开都报MMC的错,求高手解答

  • IE deinstalliert?

    2012-1-31 23:12:00

    Ich kann den IE nicht installieren,er wird wohl installiert,aber nicht ordnungsgemäß.XP

  • 本地测试web开发端的时候IE9没有响应

    2011-4-5 11:17:00

    我在测试我本地下一个网站,是用了地址(127.0.0.1或localhost)的,使用IE8好好的,没有出什么问题,后来更新了IE9,beta就出现这个问题,我还以为正式版毁修复这个问题呢,现在仍是