我也想贴,问题是代码太长了已经查到大概的原因了。
生成菜单的js用的是Erik Arvidsson的DHTML Menu 4
详见:http://webfx.eae.net (这个网站有很多有用的东东)在改变浏览器字体后就会出现这种情况。但把字体改回去也还是这样子。
现在的问题是:怎么恢复正常?我的电脑本来菜单显示正确的,现在也恢复不了了。下面是posLib.js的代码。//<script>
/*
* Position functions
*
* This script was designed for use with DHTML Menu 4
*
* This script was created by Erik Arvidsson
* (http://webfx.eae.net/contact.html#erik)
* for WebFX (http://webfx.eae.net)
* Copyright 2002
*
* For usage see license at http://webfx.eae.net/license.html
*
* Version: 1.1
* Created: 2002-05-28
* Updated: 2002-06-06 Rewrote to use getBoundingClientRect(). This solved
* several bugs related to relative and absolute positened
* elements
*
*
*/// This only works in IE5 and IE6+ with both CSS1 and Quirk modevar posLib = { getIeBox: function (el) {
return this.ie && el.document.compatMode != "CSS1Compat";
},
// relative client viewport (outer borders of viewport)
getClientLeft: function (el) {
var r = el.getBoundingClientRect();
return r.left - this.getBorderLeftWidth(this.getCanvasElement(el));
}, getClientTop: function (el) {
var r = el.getBoundingClientRect();
return r.top - this.getBorderTopWidth(this.getCanvasElement(el));
}, // relative canvas/document (outer borders of canvas/document,
// outside borders of element)
getLeft: function (el) {
return this.getClientLeft(el) + this.getCanvasElement(el).scrollLeft;
}, getTop: function (el) {
return this.getClientTop(el) + this.getCanvasElement(el).scrollTop;
}, // relative canvas/document (outer borders of canvas/document,
// inside borders of element)
getInnerLeft: function (el) {
return this.getLeft(el) + this.getBorderLeftWidth(el);
}, getInnerTop: function (el) {
return this.getTop(el) + this.getBorderTopWidth(el);
}, // width and height (outer, border-box)
getWidth: function (el) {
return el.offsetWidth;
}, getHeight: function (el) {
return el.offsetHeight;
}, getCanvasElement: function (el) {
var doc = el.ownerDocument || el.document; // IE55 bug
if (doc.compatMode == "CSS1Compat")
return doc.documentElement;
else
return doc.body;
}, getBorderLeftWidth: function (el) {
return el.clientLeft;
}, getBorderTopWidth: function (el) {
return el.clientTop;
}, getScreenLeft: function (el) {
var doc = el.ownerDocument || el.document; // IE55 bug
var w = doc.parentWindow;
return w.screenLeft + this.getBorderLeftWidth(this.getCanvasElement(el)) +
this.getClientLeft(el);
}, getScreenTop: function (el) {
var doc = el.ownerDocument || el.document; // IE55 bug
var w = doc.parentWindow;
return w.screenTop + this.getBorderTopWidth(this.getCanvasElement(el)) +
this.getClientTop(el);
}
};posLib.ua = navigator.userAgent;
posLib.opera = /opera [56789]|opera\/[56789]/i.test(posLib.ua);
posLib.ie = (!posLib.opera) && /MSIE/.test(posLib.ua);
posLib.ie6 = posLib.ie && /MSIE [6789]/.test(posLib.ua);
posLib.moz = !posLib.opera && /gecko/i.test(posLib.ua);
生成菜单的js用的是Erik Arvidsson的DHTML Menu 4
详见:http://webfx.eae.net (这个网站有很多有用的东东)在改变浏览器字体后就会出现这种情况。但把字体改回去也还是这样子。
现在的问题是:怎么恢复正常?我的电脑本来菜单显示正确的,现在也恢复不了了。下面是posLib.js的代码。//<script>
/*
* Position functions
*
* This script was designed for use with DHTML Menu 4
*
* This script was created by Erik Arvidsson
* (http://webfx.eae.net/contact.html#erik)
* for WebFX (http://webfx.eae.net)
* Copyright 2002
*
* For usage see license at http://webfx.eae.net/license.html
*
* Version: 1.1
* Created: 2002-05-28
* Updated: 2002-06-06 Rewrote to use getBoundingClientRect(). This solved
* several bugs related to relative and absolute positened
* elements
*
*
*/// This only works in IE5 and IE6+ with both CSS1 and Quirk modevar posLib = { getIeBox: function (el) {
return this.ie && el.document.compatMode != "CSS1Compat";
},
// relative client viewport (outer borders of viewport)
getClientLeft: function (el) {
var r = el.getBoundingClientRect();
return r.left - this.getBorderLeftWidth(this.getCanvasElement(el));
}, getClientTop: function (el) {
var r = el.getBoundingClientRect();
return r.top - this.getBorderTopWidth(this.getCanvasElement(el));
}, // relative canvas/document (outer borders of canvas/document,
// outside borders of element)
getLeft: function (el) {
return this.getClientLeft(el) + this.getCanvasElement(el).scrollLeft;
}, getTop: function (el) {
return this.getClientTop(el) + this.getCanvasElement(el).scrollTop;
}, // relative canvas/document (outer borders of canvas/document,
// inside borders of element)
getInnerLeft: function (el) {
return this.getLeft(el) + this.getBorderLeftWidth(el);
}, getInnerTop: function (el) {
return this.getTop(el) + this.getBorderTopWidth(el);
}, // width and height (outer, border-box)
getWidth: function (el) {
return el.offsetWidth;
}, getHeight: function (el) {
return el.offsetHeight;
}, getCanvasElement: function (el) {
var doc = el.ownerDocument || el.document; // IE55 bug
if (doc.compatMode == "CSS1Compat")
return doc.documentElement;
else
return doc.body;
}, getBorderLeftWidth: function (el) {
return el.clientLeft;
}, getBorderTopWidth: function (el) {
return el.clientTop;
}, getScreenLeft: function (el) {
var doc = el.ownerDocument || el.document; // IE55 bug
var w = doc.parentWindow;
return w.screenLeft + this.getBorderLeftWidth(this.getCanvasElement(el)) +
this.getClientLeft(el);
}, getScreenTop: function (el) {
var doc = el.ownerDocument || el.document; // IE55 bug
var w = doc.parentWindow;
return w.screenTop + this.getBorderTopWidth(this.getCanvasElement(el)) +
this.getClientTop(el);
}
};posLib.ua = navigator.userAgent;
posLib.opera = /opera [56789]|opera\/[56789]/i.test(posLib.ua);
posLib.ie = (!posLib.opera) && /MSIE/.test(posLib.ua);
posLib.ie6 = posLib.ie && /MSIE [6789]/.test(posLib.ua);
posLib.moz = !posLib.opera && /gecko/i.test(posLib.ua);
// menuCache
//var menuCache = {
_count: 0,
_idPrefix: "-menu-cache-", getId: function () {
return this._idPrefix + this._count++;
}, remove: function ( o ) {
delete this[ o.id ];
}
};////////////////////////////////////////////////////////////////////////////////////
// Menu
//function Menu() {
this.items = [];
this.parentMenu = null;
this.parentMenuItem = null;
this.popup = null;
this.shownSubMenu = null;
this._aboutToShowSubMenu = false; this.selectedIndex = -1;
this._drawn = false;
this._scrollingMode = false;
this._showTimer = null;
this._closeTimer = null; this._onCloseInterval = null;
this._closed = true;
this._closedAt = 0; this._cachedSizes = {};
this._measureInvalid = true; this.id = menuCache.getId();
menuCache[ this.id ] = this;
}Menu.prototype.cssFile = "Class/winclassic.css"; //菜单风格文件
Menu.prototype.cssText = null;
Menu.prototype.mouseHoverDisabled = false;
Menu.prototype.showTimeout = 250;
Menu.prototype.closeTimeout = 250;Menu.keyboardAccelKey = 27; // the keyCode for the key tp activate
Menu.keyboardAccelKey2 = 121; // the menubar
Menu.keyboardAccelProperty = "ctrlKey"; // when this property is true default
// actions will be canceled on a menu
// Use -1 to disable keyboard invoke of the menubar
// Use "" to allow all normal keyboard commands inside the menusMenu.prototype.add = function ( mi, beforeMi ) {
if ( beforeMi != null ) {
var items = this.items;
var l = items.length;
var i = 0;
for ( ; i < l; i++ ) {
if ( items[i] == beforeMi )
break;
}
this.items = items.slice( 0, i ).concat( mi ).concat( items.slice( i, l ) );
// update itemIndex
for (var j = i; j < l + 1; j++)
this.items[j].itemIndex = j;
}
else {
this.items.push( mi );
mi.itemIndex = this.items.length - 1;
} mi.parentMenu = this;
if ( mi.subMenu ) {
mi.subMenu.parentMenu = this;
mi.subMenu.parentMenuItem = mi;
}
return mi;
};Menu.prototype.remove = function ( mi ) {
var res = [];
var items = this.items;
var l = items.length;
for (var i = 0; i < l; i++) {
if ( items[i] != mi ) {
res.push( items[i] );
items[i].itemIndex = res.length - 1;
}
}
this.items = res;
mi.parentMenu = null;
return mi;
};Menu.prototype.toHtml = function () { var items = this.items;
var l = items.length
var itemsHtml = new Array( l );
for (var i = 0; i < l; i++)
itemsHtml[i] = items[i].toHtml(); return "<html><head>" +
(this.cssText == null ?
"<link type=\"text/css\" rel=\"StyleSheet\" href=\"" + this.cssFile + "\" />" :
"<style type=\"text/css\">" + this.cssText + "</style>") +
"</head><body class=\"menu-body\">" +
"<div class=\"outer-border\"><div class=\"inner-border\">" +
"<table id=\"scroll-up-item\" cellspacing=\"0\" style=\"display: none\">" +
"<tr class=\"disabled\"><td>" +
"<span class=\"disabled-container\"><span class=\"disabled-container\">" +
"5" +
"</span></span>" + "</td></tr></table>" +
"<div id=\"scroll-container\">" +
"<table cellspacing=\"0\">" + itemsHtml.join( "" ) + "</table>" +
"</div>" +
"<table id=\"scroll-down-item\" cellspacing=\"0\" style=\"display: none\">" +
"<tr><td>" +
"<span class=\"disabled-container\"><span class=\"disabled-container\">" +
"6" +
"</span></span>" +
"</td></tr></table>" +
"</div></div>" +
"</body></html>";
};太长了。放不下。
/*
* ScrollButton
*
* This script was designed for use with DHTML Menu 4
*
* This script was created by Erik Arvidsson
* (http://webfx.eae.net/contact.html#erik)
* for WebFX (http://webfx.eae.net)
* Copyright 2002
*
* For usage see license at http://webfx.eae.net/license.html
*
* Version: 1.02
* Created: 2002-05-28
* Updated: ??? Memory management updates
* 2003-09-23 Changed to using onunload instead onbeforeunload
*
*/////////////////////////////////////////////////////////////////////////////////////
// scroolButtonCache
//var scrollButtonCache = {
_count: 0,
_idPrefix: "-scroll-button-cache-", getId: function () {
return this._idPrefix + this._count++;
}, remove: function ( o ) {
delete this[ o.id ];
}
};function ScrollButton( oEl, oScrollContainer, nDir ) {
this.htmlElement = oEl;
this.scrollContainer = oScrollContainer;
this.dir = nDir; this.id = scrollButtonCache.getId();
scrollButtonCache[ this.id ] = this; this.makeEventListeners();
this.attachEvents();
}ScrollButton.scrollIntervalPause = 100;
ScrollButton.scrollAmount = 18;ScrollButton.prototype.startScroll = function () {
this._interval = window.setInterval(
"ScrollButton.eventListeners.oninterval(\"" + this.id + "\")",
ScrollButton.scrollIntervalPause );
};ScrollButton.prototype.endScroll = function () {
if ( this._interval != null ) {
window.clearInterval( this._interval );
delete this._interval;
}
};ScrollButton.prototype.makeEventListeners = function () {
if ( this.eventListeners != null )
return; this.eventListeners = {
onmouseover: new Function( "ScrollButton.eventListeners.onmouseover(\"" + this.id + "\")" ),
onmouseout: new Function( "ScrollButton.eventListeners.onmouseout(\"" + this.id + "\")" ),
onunload: new Function( "ScrollButton.eventListeners.onunload(\"" + this.id + "\")" )
};
};ScrollButton.prototype.attachEvents = function () {
if ( this.eventListeners == null )
return; this.htmlElement.attachEvent( "onmouseover", this.eventListeners.onmouseover );
this.htmlElement.attachEvent( "onmouseout", this.eventListeners.onmouseout );
window.attachEvent( "onunload", this.eventListeners.onunload );
};ScrollButton.prototype.detachEvents = function () {
if ( this.eventListeners == null )
return; this.htmlElement.detachEvent( "onmouseover", this.eventListeners.onmouseover );
this.htmlElement.detachEvent( "onmouseout", this.eventListeners.onmouseout );
window.detachEvent( "onunload", this.eventListeners.onunload );
};ScrollButton.prototype.destroy = function () {
this.endScroll();
this.detachEvents(); this.htmlElement = null;
this.scrollContainer = null;
this.eventListeners = null; scrollButtonCache.remove( this );
};ScrollButton.eventListeners = {
onmouseover: function ( id ) {
scrollButtonCache[id].startScroll();
}, onmouseout: function ( id ) {
scrollButtonCache[id].endScroll();
}, oninterval: function ( id ) {
var oThis = scrollButtonCache[id];
switch ( oThis.dir ) {
case 8:
oThis.scrollContainer.scrollTop -= ScrollButton.scrollAmount;
break; case 2:
oThis.scrollContainer.scrollTop += ScrollButton.scrollAmount;
break; case 4:
oThis.scrollContainer.scrollLeft -= ScrollButton.scrollAmount;
break; case 6:
oThis.scrollContainer.scrollLeft += ScrollButton.scrollAmount;
break;
}
}, onunload: function ( id ) {
scrollButtonCache[id].destroy();
}
};