<HTML>
<HEAD>
<TITLE>菜单导航篇--顶部菜单</TITLE>
</HEAD>
<BODY bgcolor="#fef4d2" >
<br><br>
<center>
<font color="ffaafa"><h2>菜单导航篇--顶部菜单</h2></font>
<hr width=300>
<br><br>
<!-- 案例代码开始 -->
<script language=JavaScript>
var JDWMinIE4 = (document.all) ? 1 : 0;
var JDWMinIE5 = (JDWMinIE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;
function hideLayer(layer) {
if (JDWMinIE4) layer.style.visibility = "hidden";
}
function showLayer(layer) {
if (JDWMinIE4) layer.style.visibility = "visible";
}
function inheritLayer(layer) {
if (JDWMinIE4) layer.style.visibility = "inherit";
}
function getVisibility(layer) {
if (JDWMinIE4)return layer.style.visibility;
return "";
}
function moveLayerTo(layer, x, y) {
if (JDWMinIE4) {
layer.style.left = x;
layer.style.top = y; }
}
function moveLayerBy(layer, dx, dy) {
if (JDWMinIE4) {
layer.style.pixelLeft += dx;
layer.style.pixelTop += dy; }
}
function getLeft(layer) {
if (JDWMinIE4)return layer.style.pixelLeft;
return -1;
}
function getTop(layer) {
if (JDWMinIE4)return layer.style.pixelTop;
return -1;
}
function getRight(layer) {
if (JDWMinIE4)return layer.style.pixelLeft + getWidth(layer);
return -1;
}
function getBottom(layer) {
if (JDWMinIE4)return layer.style.pixelTop + getHeight(layer);
return -1;
}
function getPageLeft(layer) {
var x;
if (JDWMinIE4) {
x = 0;
while (layer.offsetParent != null) {
x += layer.offsetLeft;
layer = layer.offsetParent;}
x += layer.offsetLeft;
return x;}
return -1;
}
function getPageTop(layer) {
var y;
if (JDWMinIE4) {
y = 0;
while (layer.offsetParent != null) {
y += layer.offsetTop;
layer = layer.offsetParent;}
y += layer.offsetTop;
return y;}
return -1;
}
function getWidth(layer) {
if (JDWMinIE4) {
if (layer.style.pixelWidth)return layer.style.pixelWidth;
else return layer.clientWidth;}
return -1;
}
function getHeight(layer) {
if (JDWMinIE4) {
if (layer.style.pixelHeight)return layer.style.pixelHeight;
else return layer.clientHeight;}
return -1;
}
function getzIndex(layer) {
if (JDWMinIE4)return layer.style.zIndex;
return -1;
}
function setzIndex(layer, z) {
if (JDWMinIE4)layer.style.zIndex = z;
}
function clipLayer(layer, clipleft, cliptop, clipright, clipbottom) {
if (JDWMinIE4)layer.style.clip = 'rect(' + cliptop + ' ' + clipright + ' ' + clipbottom + ' ' + clipleft +')';
}
function getClipLeft(layer) {
if (JDWMinIE4) {
var str = layer.style.clip;
if (!str)return 0;
var clip = getIEClipValues(layer.style.clip);
return(clip[3]);}
return -1;
}
function getClipTop(layer) {
if (JDWMinIE4) {
var str = layer.style.clip;
if (!str)return 0;
var clip = getIEClipValues(layer.style.clip);
return clip[0];}
return -1;
}
function getClipRight(layer) {
if (JDWMinIE4) {
var str = layer.style.clip;
if (!str)return layer.style.pixelWidth;
var clip = getIEClipValues(layer.style.clip);
return clip[1];}
return -1;
}
function getClipBottom(layer) {
if (JDWMinIE4) {
var str = layer.style.clip;
if (!str)return layer.style.pixelHeight;
var clip = getIEClipValues(layer.style.clip);
return clip[2];}
return -1;
}
function getClipWidth(layer) {
if (JDWMinIE4) {
var str = layer.style.clip;
if (!str)return layer.style.pixelWidth;
var clip = getIEClipValues(layer.style.clip);
return clip[1] - clip[3];}
return -1;
}
function getClipHeight(layer) {
if (JDWMinIE4) {
var str = layer.style.clip;
if (!str)return layer.style.pixelHeight;
var clip = getIEClipValues(layer.style.clip);
return clip[2] - clip[0];}
return -1;
}
function getIEClipValues(str) {
var clip = new Array();
var i;
i = str.indexOf("(");
clip[0] = parseInt(str.substring(i + 1, str.length), 10);
i = str.indexOf(" ", i + 1);
clip[1] = parseInt(str.substring(i + 1, str.length), 10);
i = str.indexOf(" ", i + 1);
clip[2] = parseInt(str.substring(i + 1, str.length), 10);
i = str.indexOf(" ", i + 1);
clip[3] = parseInt(str.substring(i + 1, str.length), 10);
return clip;
}
function scrollLayerTo(layer, x, y, bound) {
var dx = getClipLeft(layer) - x;
var dy = getClipTop(layer) - y;
scrollLayerBy(layer, -dx, -dy, bound);
}
function scrollLayerBy(layer, dx, dy, bound) {
var cl = getClipLeft(layer);
var ct = getClipTop(layer);
var cr = getClipRight(layer);
var cb = getClipBottom(layer);
if (bound) {
if (cl + dx < 0)dx = -cl;
else if (cr + dx > getWidth(layer))dx = getWidth(layer) - cr;
if (ct + dy < 0)dy = -ct;
else if (cb + dy > getHeight(layer))dy = getHeight(layer) - cb;}
clipLayer(layer, cl + dx, ct + dy, cr + dx, cb + dy);
moveLayerBy(layer, -dx, -dy);
}
function setBgColor(layer, color) {
if (JDWMinIE4)layer.style.backgroundColor = color;
}
function getLayer(name) {
if (JDWMinIE4)return eval('document.all.' + name);
return null;
}
function findLayer(name, doc) {
var i, layer;
for (i = 0; i < doc.layers.length; i++) {
layer = doc.layers[i];
if (layer.name == name)return layer;
if (layer.document.layers.length > 0)
if ((layer = findLayer(name, layer.document)) != null)
return layer;}
return null;
}
function getWindowWidth() {
if (JDWMinIE4)return document.body.clientWidth;
return -1;
}
function getWindowHeight() {
if (JDWMinIE4)return document.body.clientHeight;
return -1;
}
function getPageWidth() {
if (JDWMinIE4)return document.body.scrollWidth;
return -1;
}
function getPageHeight() {
if (JDWMinIE4)return document.body.scrollHeight;
return -1;
}
function getPageScrollX() {
if (JDWMinIE4)return document.body.scrollLeft;
return -1;
}
function getPageScrollY() {
if (JDWMinIE4)return document.body.scrollTop;
return -1;
}
var JDWITEMs = new Array();
function ITEM(text, link) {
this.text = text;
this.link = link;
}
function ECSmenu(hdrWidth, menuWidth) {
this.hdrWidth = hdrWidth;
this.width = menuWidth;
this.height = 0;
this.items = new Array();
this.addItem = ECSmenuaddItem;
}
function ECSmenuaddItem(item) {
this.items[this.items.length] = item;
}
function JDWITEM(width) {
this.x = 0;
this.y = 0;
this.width = width;
this.height = 0;
this.align = "left";
this.minWidth = 0;
this.inverted = false;
this.menus = new Array();
this.created = false;
this.border = 2;
this.padding = 4;
this.separator = 1;
this.setSizes = JDWITEMSetSizes;
this.setColors = JDWITEMSetColors;
this.setFonts = JDWITEMSetFonts;
this.addNAVm = JDWITEMaddNAVm;
this.create = JDWITEMCreate;
this.hide = JDWITEMHide;
this.show = JDWITEMShow;
this.moveTo = JDWITEMMoveTo;
this.moveBy = JDWITEMMoveBy;
this.getzIndex = JDWITEMGetzIndex;
this.setzIndex = JDWITEMSetzIndex;
this.getWidth = JDWITEMGetWidth;
this.getMinWidth = JDWITEMGetMinWidth;
this.getAlign = JDWITEMGetAlign;
this.setAlign = JDWITEMSetAlign;
this.resize = JDWITEMResize;
this.invert = JDWITEMInvert;
this.isInverted = JDWITEMIsInverted;
this.index = JDWITEMs.length;
JDWITEMs[this.index] = this;
}
function JDWITEMSetSizes(border, padding, separator) {
if (!this.created) {
this.border = border;
this.padding = padding;
this.separator = separator; }
}
function JDWITEMSetColors(bdColor,hdrFgColor, hdrBgColor, hdrHiFgColor, hdrHiBgColor,itmFgColor, itmBgColor, itmHiFgColor, itmHiBgColor) {
if (!this.created) {
this.borderColor = bdColor;
this.hdrFgColor = hdrFgColor;
this.hdrBgColor = hdrBgColor;
this.hdrHiFgColor = hdrHiFgColor;
this.hdrHiBgColor = hdrHiBgColor;
this.itmFgColor = itmFgColor;
this.itmBgColor = itmBgColor;
this.itmHiFgColor = itmHiFgColor;
this.itmHiBgColor = itmHiBgColor; }
}
function JDWITEMSetFonts(hdrFamily, hdrStyle, hdrWeight, hdrSize,itmFamily, itmStyle, itmWeight, itmSize) {
if (!this.created) {
this.hdrFontFamily = hdrFamily;
this.hdrFontStyle = hdrStyle;
this.hdrFontWeight = hdrWeight;
this.hdrFontSiz
评论0
最新资源