ie8下菜单无法弹出
ie8下菜单无法弹出,希望有高手帮忙看看
主页代码:
<html>
<head>
<title>执法局自动化办公系统</title>
<META http-equiv=expires content=0>
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Cache-Control content=No-cache>
<META http-equiv=Cache-Control content=no-store>
<style type="text/css">
<!--
body {margin: 0px; border: 0px;}
#contentDiv {width: 100%; height: 100%;position:relative top:-100px}
#contentFrame {width: 100%; height: 100%;}
-->
</style>
<script type="text/javascript">
var currentSkinHref;
if (document.location.search == "")
currentSkinHref = "menucss/menu.css";
else
currentSkinHref = document.location.search.substr(1);
document.write('<link type="text/css" rel="stylesheet" href="' + currentSkinHref + '" id="menuStyleSheet">')
</script>
<script id=mnuscript type="text/javascript" src="publicjs\menu3.js"></script>
<script type="text/javascript">
<!--
function fixSize() {
contentDiv.style.height = document.body.offsetHeight - menuBar.offsetHeight;
}
window.onload = fixSize;
window.onresize = fixSize;
function SkinInfo(name, href, downloadURI) {
this.name = name;
this.href = href;
this.downloadURI = (downloadURI) ? downloadURI : href;
}
var skins = new Array();
skins[0] = new SkinInfo("Office 97 Look (Default)", "menucss/menu.css");
//skins[1] = new SkinInfo("QNX", "qnx/menu.css", "qnx.zip");
//skins[1] = new SkinInfo("SmartFTP", "smartFTPMenu.css");
skins[1] = new SkinInfo("White & Blue", "menucss/whiteAndBlue/menu.css", "whiteAndBlue.zip");
//skins[2] = new SkinInfo("Windows 95", "win95Menu.css");
function generateSkinMenu(skins) {
var str = "<table cellspacing='0' class='menu' id='skinMenu'>";
var currentIndex;
for (var i=0; i<skins.length; i++) {
if (currentSkinHref == skins[i].href)
currentIndex = i;
}
for (var i=0; i<skins.length; i++) {
str += "<tr href='mainboard.asp?" + skins[i].href + "'>";
str += "<td class='left'> </td>";
if (i == currentIndex)
str += "<td class='middle' nowrap style='font-weight: bold;'>" + skins[i].name + "</td>";
else
str += "<td class='middle' nowrap>" + skins[i].name + "</td>";
str += "<td class='right'> </td></tr>";
}
//str += "<tr class='disabled'><td nowrap colspan='3' style='height: 10px; padding: 0;'><div style='border: 1px inset ; height: 2; overflow: hidden;'></div></td></tr>";
//str += "<tr href='" + skins[currentIndex].downloadURI + "'>"
//str += "<td class='icon'><img src='http://webfx.eae.net/images/downloadicon.gif'></td><td class='middle' nowrap>Download this skin</td><td class='right'> </td></tr></table>";
str=str + "</table>";
return str;
}
//-->
</script>
引用css页:
body.menuContainer {background: buttonface; border: 0px solid black; margin: 0;}
table.menu {position: absolute; visibility: hidden;
background: buttonface; font: menu; border: 2px outset white;}
table.menu table.menu {display: none; visibility: hidden;}
.menuContainer .menu {visibility: visible;}
.menuContainer .menu .menu {visibility: hidden; display: block;}
.menu tr {height: 20px;}
table.menu td.more {font-family: webdings; width: 20px; text-align: right; padding-right: 1px;}
table.menu td.keyshortcut {font: menu;}
table.menu tr.disabled {color: buttonshadow;}
table.menu tr.disabled td.icon img {border: 0px solid buttonface; margin: 1px;
filter: alpha(opacity=50);}
/* Highlighted cell formattings */
table.menu tr td {padding-left: 3px; padding-right: 3px; padding-top: 1px; padding-bottom: 0px}
table.menu tr.highlight td {background: highlight; color: highlighttext;}
table.menu tr td.icon {text-align: center; padding-left: 1px; padding-right: 1px; padding-top: 1px; padding-bottom: 0px;}
table.menu tr.highlight td.icon {background: transparent;}
table.menu tr td.icon img {border: 1px solid buttonface;}
table.menu tr.highlight td.icon img {border: 1px solid; border-color: buttonhighlight buttonshadow buttonshadow buttonhighlight;}
.root,
.rootHighlight,
.rootActive {background: buttonface; width: 20px; font: menu; text-align: center; cursor: default;
border: 1px solid buttonface; padding: 1px; padding-left: 7px; padding-right: 7px;}
.root {}
.rootHighlight {border-color: buttonhighlight buttonshadow buttonshadow buttonhighlight;}
.rootActive {padding-bottom: 0px; padding-left: 8px; padding-right: 6px; padding-top: 2px;
border-color: buttonshadow buttonhighlight buttonhighlight buttonshadow;}
.root .menu {visibility: hidden;}
.rootActive .menu {visibility: hidden;}
.rootHighlight .menu {visibility: hidden;}
/* The following is a special for the Skin page */
#menuBar {background: buttonface;height:10px}
#menuBar .menuBar .root {padding: 1px;}
#menuBar .menuBar .root .middle {padding-left: 7px; padding-right: 7px;}
#menuBar .menuBar .rootHighlight .middle {padding-left: 7px; padding-right: 7px;}
#menuBar .menuBar .rootActive .middle {padding-left: 7px; padding-right: 7px;}
#menuBar .menuBar .root .left {padding: 1px;}
#menuBar .menuBar .rootHighlight .left {padding: 1px;}
#menuBar .menuBar .rootActive .left {padding: 1px;}
#menuBar .menuBar .root .right {padding: 1px;}
#menuBar .menuBar .rootHighlight .right {padding: 1px;}
#menuBar .menuBar .rootActive .right {padding: 1px;}
引用js部分代码函数
function showMenu(tableEl, boundaries, directionType, pauseTime) {
var left, top;
var borders = getBorderSizes(tableEl);
if (directionType == "vertical") {
if (boundaries.top + boundaries.height + tableEl.offsetHeight + borders.top + borders.bottom <= document.body.clientHeight + document.body.scrollTop)
top = boundaries.top + boundaries.height;
else if (boundaries.top - tableEl.offsetHeight >= document.body.scrollTop)
top = boundaries.top - tableEl.offsetHeight;
else if (document.body.clientHeight >= tableEl.offsetHeight + borders.top + borders.bottom)
top = document.body.clientHeight + document.body.scrollTop - tableEl.offsetHeight - borders.top - borders.bottom;
else
top = document.body.scrollTop;
if (boundaries.left + tableEl.offsetWidth <= document.body.clientWidth + document.body.scrollLeft)
left = boundaries.left;
else if (document.body.clientWidth >= tableEl.offsetWidth + borders.left + borders.right)
left = document.body.clientWidth + document.body.scrollLeft - tableEl.offsetWidth - borders.left - borders.right;
else
left = document.body.scrollLeft;
}
else {
if (boundaries.top + tableEl.offsetHeight - borders.top <= document.body.clientHeight + document.body.scrollTop)
top = boundaries.top - borders.top;
else if (boundaries.top + boundaries.height - tableEl.offsetHeight + borders.top >= 0)
top = boundaries.top + boundaries.height - tableEl.offsetHeight + borders.top;
else if (document.body.clientHeight >= tableEl.offsetHeight + borders.top + borders.bottom)
top = document.body.clientHeight + document.body.scrollTop - tableEl.offsetHeight - borders.top - borders.bottom;
else
top = document.body.scrollTop;;
if (boundaries.left + boundaries.width + tableEl.offsetWidth <= document.body.clientWidth + document.body.scrollLeft)
left = boundaries.left + boundaries.width;
else if (boundaries.left - tableEl.offsetWidth >= 0)
left = boundaries.left - tableEl.offsetWidth;
else if (document.body.clientWidth >= tableEl.offsetWidth + borders.left + borders.right)
left = document.body.clientWidth + document.body.scrollLeft - tableEl.offsetWidth - borders.left - borders.right;
else
left = document.body.scrollLeft;
}
if (zIndexMax == null) {
var a = document.all;
var al = a.length;
for (var i=0; i<al; i++)
zIndexMax = Math.max(zIndexMax, a[i].style.zIndex);
}
zIndexMax++;
if (pauseTime == null)
pauseTime = 0;
if (tableEl.scriptlet != null) {
tableEl.scriptlet.style.left = left;
tableEl.scriptlet.style.top = top;
if (tableEl.menuState == null)
tableEl.menuState = "hidden";
// IE doesn't repaint correctly without this thread split. Thank you Scott Isaacs for helping me with this (indiredtly!)
tmpArray[tmpCounter] = tableEl;
showTimeoutHandle = window.setTimeout(
"tmpArray[" + tmpCounter + "].scriptlet.style.zIndex = " + zIndexMax + ";" +
"tmpArray[" + tmpCounter + "].scriptlet.style.visibility = tmpArray[" + (tmpCounter++) + "].menuState;",
pauseTime);
}
else {
tmpArray[tmpCounter] = tableEl;
window.setTimeout("addScriptletMenu(tmpArray[" + (tmpCounter++) + "], " + left + ", " + top + ", " + pauseTime + ");", 0);
}
}