这是在孟子“家”里得到的一个非常好的东东。接近满足你的要求。当你的页面很长时就看到上下跳动的效果,彩单可以用做象QQ的那样,
你做点小修改吧,另外你还可以得到学到其他更多的东西,感谢孟子吧。在该网页文件里:
<SCRIPT language=javascript src="meng_content.js"></SCRIPT>
<SCRIPT language=javascript src="meng.js"></SCRIPT>
<SCRIPT language=javascript src="meng_style.js"></SCRIPT>
<BODY onload="initGroup('sample')">
你做点小修改吧,另外你还可以得到学到其他更多的东西,感谢孟子吧。在该网页文件里:
<SCRIPT language=javascript src="meng_content.js"></SCRIPT>
<SCRIPT language=javascript src="meng.js"></SCRIPT>
<SCRIPT language=javascript src="meng_style.js"></SCRIPT>
<BODY onload="initGroup('sample')">
---------------------------
// 【孟宪会之精彩世界】最后更改日期:2000年8月29日// ------
var isIE4=false,isNN4=false;
var flagMenu="M",flagLink="L",flagCommand="C",flagSeparator="S",flagInfo="I",flagImageLink="iL",flagImageMenu="iM",flagImageCommand="iC";
var menuTimer=600,layerCount=0,imageCount=0;
var groupValid=true,instanceValid=true,instanceReady=false;
var turnOn="",turnOff="",menuOffset=0;
var onePixel=new Image(1,1); onePixel.src="tags/onePixel.gif";
var pixelImage='<img src="'+onePixel.src+'" width="1" height="1" border="0">';
var defaultTag=new Image(7,7); defaultTag.src="tags/tag1r.gif";
var yxG=new Array(),gCount=0,yxGroup=null,yxI=new Array(),iCount=0,yxS=new Array(),sCount=0,yxStyle=null;
var popInstance=-1,popRegistered=false,mapRegistered=false,mapX=0,mapY=0;
var frameWidth=0,frameHeight=0,halfWidth=0,halfHeight=0,contentWidth=0,contentHeight=0,scrollBar=20;
var lastInstance=-1,lastIndex=1,holdOn=false;// ------
function getArray(_array) { return eval("window."+_array); }
function getID() { return "yxLayer"+(++layerCount)+""; }
function getName() { return "yxImage"+(++imageCount)+""; }
function showMessage(_message) { window.status=_message; }
function showError(_error) { showMessage(_error); groupValid=false; }
function checkBrowser() { isIE4=(document.all)?true:false; isNN4=(document.layers)?true:false; }function setParameter() {
if (isNN4) {
turnOn="show"; turnOff="hidden"; menuOffset=1;
}
else {
turnOn="visible"; turnOff="hidden"; menuOffset=2;
}
}function getGroup(_name) {
var theGroup=null; for (var i=0; i<gCount; i++) {
if (yxG[i].name==_name) { theGroup=yxG[i]; break; }
} return theGroup;
}function _getHolder(_name) {
var holder=null; if (isIE4) {
if (document.all[_name]) { holder=document.all[_name]; holder.css=holder.style; }
}
else {
if (document.layers[_name]) { holder=document.layers[_name]; holder.css=holder; }
} holder.xx=0; holder.yy=0; return holder;
}function _makeHolder(_position) {
var holder=null,holderX=0,holderY=0; holderX=(contentWidth)-((_position==0 || _position==6 || _position==7)?contentWidth:((_position==1 || _position==5 || _position==8)?halfWidth:0));
holderY=(contentHeight)-((_position==0 || _position==1 || _position==2)?contentHeight:((_position==3 || _position==7 || _position==8)?halfHeight:0)); if (isIE4) {
var layerID=getID();
document.body.insertAdjacentHTML("BeforeEnd",('<div id="'+layerID+'" style="position:absolute; left:'+holderX+'; top:'+holderY+'; width:0; visibility:visible; z-index:1;"></div>'));
holder=document.all[layerID]; holder.css=holder.style;
}
else {
holder=new Layer(1); holder.zIndex=1;
holder.visibility="show"; holder.left=holderX; holder.top=holderY; holder.css=holder;
} holder.xx=holderX; holder.yy=holderY; return holder;
}function _getLeft(_holder) { return (_holder.offsetParent.tagName=="BODY")?(_holder.offsetLeft):(_holder.offsetLeft+_getLeft(_holder.offsetParent)); }
function _getTop(_holder) { return (_holder.offsetParent.tagName=="BODY")?(_holder.offsetTop):(_holder.offsetTop+_getTop(_holder.offsetParent)); }
function getTop(_holder) { return (isIE4)?_getTop(_holder):_holder.pageY; }function getHolder(_name,_position,_x,_y) {
var holder=null; if (_name!="") { holder=_getHolder(_name); }
if (holder==null) { holder=_makeHolder(_position); } moveLayerBy(holder,_x,_y);
holder.xx+=_x; holder.yy+=_y; holder.dy=getTop(holder); return holder;
}function getStyle(_name) {
_name=(_name=="")?"default":_name;
for (var i=0; i<sCount; i++) {
if (yxS[i].styleName==_name) { return yxS[i]; }
} return yxStyle;
}function getLength(_content) {
var theLength=0; if (isIE4) {
var layerID=getID();
document.body.insertAdjacentHTML("BeforeEnd",('<div id="'+layerID+'" style="position:absolute; visibility:hidden;">'+_content+'</div>'));
theLength=document.all[layerID].children[0].offsetWidth;
}
else {
var layer=new Layer(1);
layer.visibility="hidden";
with (layer.document) {
open(); writeln(_content); close();
} theLength=layer.document.width;
} return theLength;
}function makeLayer(_width,_content,_color,_index,_holder) {
var layer=null; if (isIE4) {
var layerID=getID();
_holder.insertAdjacentHTML("BeforeEnd",('<div id="'+layerID+'" style="position:absolute; left:0; top:0; width:'+_width+'; background-color:'+_color+'; visibility:hidden; z-index:'+_index+';">'+_content+'</div>'));
layer=_holder.document.all[layerID]; layer.css=layer.style;
}
else {
layer=new Layer(_width,_holder); layer.zIndex=_index;
layer.visibility="hidden"; layer.left=-_width; layer.top=0; with (layer.document) {
open(); writeln(_content); close();
} layer.bgColor=_color; layer.css=layer;
} return layer;
}function moveLayerTo(_layer,_x,_y) {
if (isIE4) {
_layer.style.pixelLeft=_x; _layer.style.pixelTop=_y;
}
else {
_layer.moveTo(_x,_y);
}
}function moveLayerBy(_layer,_x,_y) {
if (isIE4) {
_layer.style.pixelLeft+=_x; _layer.style.pixelTop+=_y;
}
else {
_layer.moveBy(_x,_y);
}
}function makeSeparator(_separator,_width,_height,_form,_style) {
var itemWidth=0,itemHeight=0,itemLayout=""; if (_form==0) {
itemWidth=_width-_style.spacing*2; itemHeight=2;
itemLayout='<table align="left" width="'+itemWidth+'" height="2" cellpadding="0" cellspacing="0" border="0"><tr align="left" valign="top"><td bgcolor="'+_style.borderColorDark+'" width="'+itemWidth+'" height="1">'+pixelImage+'</td></tr><tr align="left" valign="top"><td bgcolor="'+_style.borderColorBright+'" width="'+itemWidth+'" height="1">'+pixelImage+'</td></tr></table>';
}
else {
itemWidth=2; itemHeight=_height-_style.spacing*2;
itemLayout='<table align="left" width="2" height="'+itemHeight+'" cellpadding="0" cellspacing="0" border="0"><tr align="left" valign="top"><td bgcolor="'+_style.borderColorDark+'" width="1" height="'+itemHeight+'">'+pixelImage+'</td><td bgcolor="'+_style.borderColorBright+'" width="1" height="'+itemHeight+'">'+pixelImage+'</td></tr></table>';
} if (isIE4) {
_separator.layer.innerHTML=itemLayout;
}
else {
with (_separator.layer.document) {
open(); writeln(itemLayout); close();
}
} _separator.width=itemWidth; _separator.height=itemHeight;
}function setClip(_layer,_x1,_y1,_x2,_y2) {
_layer.clip.left=_x1; _layer.clip.top=_y1;
_layer.clip.width=_x2-_x1; _layer.clip.height=_y2-_y1;
}function blurIt(_items) {
var itemCount=_items.length;
for (var i=0; i<itemCount; i++) {
if (_items[i].layer.focused) {
if (_items[i].type==flagMenu || _items[i].type==flagImageMenu) { _items[i].menu.hideMenu(); } _items[i].layer.turnColor(false);
break;
}
}
}function _initGroup() {
showMessage("Parsing menu definitions"); gCount=yxGroup.length;
for (var i=0; i<gCount && groupValid; i++) {
yxG[i]=new _groupOBJ(yxGroup[i]);
yxG[i].readGroup();
} if (groupValid) {
yxStyle=new _styleOBJ("default",6,1,2,"#cccccc","#cccccc","#ffffff",1,"#f8f8f8","#666666","宋体",14,"normal","none","#000000",1,7,7,"tag1r.gif","tags/",100);
showMessage("无效的菜单结构"); setDIM(); buildMenu(); if (instanceValid) {
instanceReady=true; window.onresize=resizeFrame; showMessage("^_^ 【孟宪会之精彩世界】之导航菜单加载完成! ~0~");
}
}
}function _addStyle(_styleName,_paddingWidth,_paddingHeight,_spacing,_spacingColor,_colorNormal,_colorHighlighted,_border,_borderColorBright,_borderColorDark,_textFont,_textSize,_textWeight,_textDecoration,_textColor,_tag,_tagWidth,_tagHeight,_tagImage,_imagePath,_widthRatio) {
yxS[sCount++]=new _styleOBJ(_styleName,_paddingWidth,_paddingHeight,_spacing,_spacingColor,_colorNormal,_colorHighlighted,_border,_borderColorBright,_borderColorDark,_textFont,_textSize,_textWeight,_textDecoration,_textColor,_tag,_tagWidth,_tagHeight,_tagImage,_imagePath,_widthRatio);
}function _addInstance(_name,_type,_position,_holder,_x,_y,_direction,_form,_initial,_target,_group,_style1,_style2) {
if (instanceValid) {
showMessage("正在加载: "+_name+"!请稍候………………"); var iIndex=iCount++;
yxI[iIndex]=new instanceOBJ(iIndex,_name,_type,_position,_holder,_x,_y,_direction,_form,_initial,_target,_group,_style1,_style2); if (yxI[iIndex].group!=null) {
yxI[iIndex].makeInstance();
if (yxI[iIndex].initial) { yxI[iIndex].showInstance(); } if (yxI[iIndex].type==1 && !mapRegistered) {
mapRegistered=true;
yxI[iIndex].registerMap();
}
else if (yxI[iIndex].type==2 && !popRegistered) {
popRegistered=true;
yxI[iIndex].registerPop();
}
else if (yxI[iIndex].type==3) {
yxI[iIndex].checkInstance();
} showMessage("Added menu instance: ["+_name+"]");
}
else {
instanceValid=false;
showError("Menu Group Not Found: ["+_group+"] for Instance ["+_name+"]");
}
}
}function getInstance(_name) {
for (var i=0; i<iCount; i++) {
if (yxI[i].name==_name) { return i; }
} return -1;
}function setDIM() {
if (isNN4) {
frameWidth=window.innerWidth; frameHeight=window.innerHeight;
contentWidth=(frameHeight<window.document.height)?(frameWidth-scrollBar):(frameWidth);
contentHeight=(frameWidth<window.document.width)?(frameHeight-scrollBar):(frameHeight);
}
else {
contentWidth=window.document.body.clientWidth; contentHeight=window.document.body.clientHeight;
} halfWidth=Math.ceil(contentWidth/2); halfHeight=Math.ceil(contentHeight/2);
}function resizeFrame() {
if (isNN4) {
if (window.innerWidth!=frameWidth || window.innerHeight!=frameHeight) { document.location.reload(); }
}
else {
var oldWidth=contentWidth,oldHeight=contentHeight;
setDIM();
var dx=contentWidth-oldWidth,dy=contentHeight-oldHeight; if (dx!=0 || dy!=0) {
for (var i=0; i<iCount; i++) {
if ((yxI[i].position==2 || yxI[i].position==3 || yxI[i].position==4) && dx!=0) { yxI[i].holder.xx+=dx; }
if ((yxI[i].position==1 || yxI[i].position==5 || yxI[i].position==8) && dx!=0) { yxI[i].holder.xx+=Math.floor(dx/2); }
if ((yxI[i].position==4 || yxI[i].position==5 || yxI[i].position==6) && dy!=0) { yxI[i].holder.yy+=dy; }
if ((yxI[i].position==3 || yxI[i].position==7 || yxI[i].position==8) && dy!=0) { yxI[i].holder.yy+=Math.floor(dy/2); } yxI[i].moveInstanceTo(yxI[i].holder.xx,yxI[i].holder.yy);
}
}
}
}function popMenu(e) {
if (!holdOn) {
holdOn=true; var menuX=0,menuY=0;
if (isIE4) {
menuX=event.clientX+window.document.body.scrollLeft; menuY=event.clientY+window.document.body.scrollTop;
}
else {
menuX=e.pageX; menuY=e.pageY;
} for (var i=0; i<iCount; i++) {
if (i==popInstance) {
menuX+=(yxI[i].direction==0 || yxI[i].direction==3)?-menuOffset:menuOffset;
menuY+=(yxI[i].direction==0 || yxI[i].direction==1)?-menuOffset:menuOffset; yxI[i].moveInstanceTo(menuX,menuY);
yxI[i].showInstance();
}
else {
yxI[i].hideInstance();
}
} holdOn=false;
} return false;
}function mapMenu(e) {
if (isIE4) {
mapX=event.clientX+window.document.body.scrollLeft; mapY=event.clientY+window.document.body.scrollTop;
}
else {
mapX=e.pageX; mapY=e.pageY;
} return true;
}function _hideInstance(_instance) { yxI[_instance].timer=eval('setTimeout("yxI['+_instance+'].hideInstance()",'+menuTimer+')'); }
function clearTimer(_instance) { clearTimeout(yxI[_instance].timer); }function _checkInstance(_instance) {
var holder=yxI[_instance].holder; if (isIE4) {
holder.style.pixelLeft=holder.xx+window.document.body.scrollLeft;
holder.style.pixelTop=holder.yy+window.document.body.scrollTop;
}
else {
holder.moveTo(holder.xx+window.pageXOffset,holder.yy+window.pageYOffset);
}
holder.dy=getTop(holder);
}function _openMap(_name) {
if (!holdOn && instanceReady) {
holdOn=true; for (var i=0; i<iCount; i++) {
if (yxI[i].name==_name) {
mapX+=((yxI[i].direction==0 || yxI[i].direction==3)?-menuOffset:menuOffset);
mapY+=((yxI[i].direction==0 || yxI[i].direction==1)?-menuOffset:menuOffset); yxI[i].moveInstanceTo(mapX,mapY);
yxI[i].showInstance();
}
else {
yxI[i].hideInstance();
}
} holdOn=false;
return true;
}
return false;
}function _openMenu(_name) {
if (!holdOn && instanceReady) {
holdOn=true; for (var i=0; i<iCount; i++) {
if (yxI[i].name==_name) {
yxI[i].showInstance();
}
else {
yxI[i].hideInstance();
}
} holdOn=false;
return true;
}
return false;
}function _closeMenu(_name) {
if (!holdOn && instanceReady) {
holdOn=true; var iIndex=getInstance(_name);
if (iIndex!=-1) {
if (yxI[iIndex].shown) { _hideInstance(iIndex); }
} holdOn=false;
return true;
}
return false;
}function _closeMenuNow(_name) {
if (!holdOn && instanceReady) {
holdOn=true; var iIndex=getInstance(_name);
if (iIndex!=-1) {
if (yxI[iIndex].shown) { yxI[iIndex].hideInstance(); }
} holdOn=false;
return true;
}
return false;
}function _switchMenu(_name) {
if (!holdOn && instanceReady) {
holdOn=true; for (var i=0; i<iCount; i++) {
if (yxI[i].name==_name) {
if (yxI[i].shown) {
yxI[i].hideInstance();
}
else {
yxI[i].showInstance();
}
}
else {
yxI[i].hideInstance();
}
} holdOn=false;
return true;
}
return false;
}function _moveMenuTo(_name,_x,_y) {
if (instanceReady) {
var iIndex=getInstance(_name);
if (iIndex!=-1) {
yxI[iIndex].moveInstanceTo(_x,_y);
return true;
}
}
return false;
}function _moveMenuBy(_name,_x,_y) {
if (instanceReady) {
var iIndex=getInstance(_name);
if (iIndex!=-1) {
yxI[iIndex].moveInstanceBy(_x,_y);
return true;
}
}
return false;
}function _getMenuDim(_name) {
if (instanceReady) {
var iIndex=getInstance(_name);
if (iIndex!=-1) {
var pad=yxI[iIndex].menu.pad.layer;
if (isIE4) {
_obj=pad.children[0];
return (new dimOBJ(_getLeft(pad),_getTop(pad),_obj.offsetWidth,_obj.offsetHeight,window.document.body.scrollLeft,window.document.body.scrollTop));
}
else {
return (new dimOBJ(pad.pageX,pad.pageY,pad.document.width,pad.document.height,window.pageXOffset,window.pageYOffset));
}
}
}
return null;
}function _getItemDim(_name,_item) {
if (instanceReady) {
var iIndex=getInstance(_name);
if (iIndex!=-1) {
if (_item<yxI[iIndex].menu.items.length) {
var item=yxI[iIndex].menu.items[_item].layer;
if (isIE4) {
_obj=item.children[0];
return (new dimOBJ(_getLeft(pad),_getTop(pad),_obj.offsetWidth,_obj.offsetHeight,window.document.body.scrollLeft,window.document.body.scrollTop));
}
else {
return (new dimOBJ(item.pageX,item.pageY,item.document.width,item.document.height,window.pageXOffset,window.pageYOffset));
}
}
}
}
return null;
}// ------
function dimOBJ(_x,_y,_width,_height,_scrollX,_scrollY) {
this.x=_x; this.y=_y; this.width=_width; this.height=_height; this.scrollX=_scrollX; this.scrollY=_scrollY;
}function _itemOBJ(_ITEM) {
this.type=_ITEM[0]; if (this.type!=flagSeparator) {
this.name=_ITEM[1]; if (this.type!=flagInfo) {
this.help=_ITEM[2];
this.value=_ITEM[3]; if (this.type==flagMenu || this.type==flagImageMenu) {
this.menu=new _menuOBJ(_ITEM[4],parseInt(_ITEM[5]));
this.tag=_ITEM[6];
}
else {
this.tag="0";
} if (this.type==flagCommand || this.type==flagImageCommand || this.type==flagLink || this.type==flagImageLink) {
this.onCodes=_ITEM[4]; this.outCodes=_ITEM[5];
} if (this.type==flagImageLink || this.type==flagImageCommand) {
this.initial=_ITEM[6]; this.swapping=_ITEM[7];
this.imageWidth=parseInt(_ITEM[8]); this.imageHeight=parseInt(_ITEM[9]);
}
else if (this.type==flagImageMenu) {
this.initial=_ITEM[7]; this.swapping=_ITEM[8];
this.imageWidth=parseInt(_ITEM[9]); this.imageHeight=parseInt(_ITEM[10]);
}
}
}
}function _menuOBJ(_array,_width) {
this.array=_array;
this.width=_width; this.items=new Array(); this.readMenu=readMenu;
}function _groupOBJ(_GROUP) {
this.name=_GROUP[0]; this.menu=new _menuOBJ(_GROUP[1],parseInt(_GROUP[2])); this.readGroup=readGroup;
}function _styleOBJ(_styleName,_paddingWidth,_paddingHeight,_spacing,_spacingColor,_colorNormal,_colorHighlighted,_border,_borderColorBright,_borderColorDark,_textFont,_textSize,_textWeight,_textDecoration,_textColor,_tag,_tagWidth,_tagHeight,_tagImage,_imagePath,_widthRatio) {
this.styleName=_styleName;
this.paddingWidth=_paddingWidth; this.paddingHeight=_paddingHeight;
this.spacing=_spacing; this.spacingColor=_spacingColor;
this.colorNormal=_colorNormal; this.colorHighlighted=_colorHighlighted;
this.borderOn=(_border==0)?false:true; this.borderColorBright=_borderColorBright; this.borderColorDark=_borderColorDark;
this.textFont=_textFont; this.textSize=_textSize; this.textWeight=_textWeight; this.textDecoration=_textDecoration; this.textColor=_textColor;
this.tagOn=(_tag==0)?false:true; this.tagWidth=_tagWidth; this.tagHeight=_tagHeight; this.tagImage=_tagImage;
this.imagePath=_imagePath;
this.widthRatio=_widthRatio;
}function styleOBJ(_style) {
this.tagOpening='<span style="text-decoration:'+_style.textDecoration+'; font-size:'+_style.textSize+'px; color:'+_style.textColor+'; font-weight:'+_style.textWeight+'; font-family:'+_style.textFont+';">';
this.tagClosing='</span>';
this.tagImage='<td width="'+_style.tagWidth+'" align="left" valign="middle"><img src="'+_style.imagePath+_style.tagImage+'" width="'+_style.tagWidth+'" height="'+_style.tagHeight+'" border="0"></td>';
this.tagDummy='<td width="'+_style.tagWidth+'" align="left" valign="middle">'+pixelImage+'</td>';
this.paddingCol=(_style.paddingWidth==0)?'':('<td width="'+_style.paddingWidth+'">'+pixelImage+'</td>');
}function itemOBJ(_instance,_type) {
this.instance=_instance;
this.type=_type; this.x=0; this.y=0;
this.width=0; this.height=0; this.layer=null; this.makeItem=makeItem;
this.showItem=showIt;
this.hideItem=hideIt;
this.moveItem=moveIt; if (this.type==flagMenu || this.type==flagImageMenu) {
this.menu=new menuOBJ(this.instance,false);
}
}function padOBJ(_instance) {
this.instance=_instance; this.x=0; this.y=0; this.dy=0;
this.width=0; this.height=0; this.layer=null; this.makePad=makePad;
this.showPad=showIt;
this.hidePad=hideIt;
this.movePad=moveIt;
}function menuOBJ(_instance,_initial) {
this.instance=_instance;
this.initial=_initial; this.shown=false;
this.clipX=0; this.clipY=0; this.clipWidth=0; this.clipHeight=0; this.pad=new padOBJ(this.instance);
this.items=new Array(); this.makeMenu=makeMenu;
this.showMenu=showMenu;
this.hideMenu=hideMenu;
}function instanceOBJ(_instance,_name,_type,_position,_holder,_x,_y,_direction,_form,_initial,_target,_group,_style1,_style2) {
this.instance=_instance,
this.name=_name;
this.type=_type;
this.position=_position;
this.holder=getHolder(((_type!=1 && _type!=2)?_holder:""),_position,_x,_y);
this.x=0; this.y=0;
this.direction=_direction;
this.form=_form;
this.initial=(_initial==0)?false:true;
this.target=(_target=="")?'':(' target="'+_target+'"');
this.group=getGroup(_group); this.style=new Array();
this.style[0]=getStyle(_style1); this.style[1]=getStyle(_style2); this.styleX=new Array();
this.styleX[0]=new styleOBJ(this.style[0]); this.styleX[1]=new styleOBJ(this.style[1]); this.maxX=0; this.maxY=0; this.minX=0; this.minY=0; this.timer=-1;
this.shown=false; this.menu=new menuOBJ(this.instance,this.initial); this.makeInstance=makeInstance;
this.showInstance=showInstance;
this.hideInstance=hideInstance;
this.moveInstanceTo=moveInstanceTo;
this.moveInstanceBy=moveInstanceBy;
this.checkInstance=checkInstance;
this.registerPop=registerPop;
this.registerMap=registerMap;
}// ------
function readMenu() {
var theMenu=getArray(this.array);
if (theMenu) {
var menuLength=theMenu.length;
for (var i=0; i<menuLength && groupValid; i++) {
this.items[i]=new _itemOBJ(theMenu[i]); if (this.items[i].type==flagMenu || this.items[i].type==flagImageMenu) { this.items[i].menu.readMenu(); }
}
}
else {
showError("Menu Not Found: ["+this.array+"]");
}
}function readGroup() { this.menu.readMenu(); }
function showIt() { this.layer.css.visibility=turnOn; }
function hideIt() { this.layer.css.visibility=turnOff; }
function moveIt(_x,_y) { moveLayerTo(this.layer,_x,_y); }function makeItem(item,_tag,_width,_index,_form,_active,_level) {
var instance=yxI[this.instance],iStyle=instance.style[_level],iStyleX=instance.styleX[_level],holder=instance.holder;
var itemBar="",itemIt=""
var paddingSpan=(((iStyle.paddingWidth==0)?1:3)+((_tag)?1:0));
var paddingRow="",tagContent="",barWidth=(item.type==flagSeparator)?2:(_width+((_tag)?iStyle.tagWidth:0)+iStyle.paddingWidth*2); if (item.type==flagSeparator) {
itemBar='<table align="left" width="2" height="2" cellpadding="0" cellspacing="0" border="0"><tr><td width="2" height="2"></td></tr></table>';
}
else {
tagContent=(_tag)?(((item.type==flagImageMenu)||(item.type==flagMenu))?((item.tag=="0")?iStyleX.tagDummy:iStyleX.tagImage):iStyleX.tagDummy):""; if (item.type==flagImageLink || item.type==flagImageMenu || item.type==flagImageCommand) {
if (_form!=2) {
var imageWidth=(item.imageWidth<=_width)?item.imageWidth:_width;
var imageHeight=Math.floor(item.imageHeight*imageWidth/item.imageWidth);
}
else {
var imageWidth=item.imageWidth,imageHeight=item.imageHeight; barWidth+=(imageWidth-_width);
} var imageName=getName();
itemIt='<img src="'+iStyle.imagePath+item.initial+'" name="'+imageName+'" width="'+imageWidth+'" height="'+imageHeight+'" border="0">'
}
else {
itemIt=iStyleX.tagOpening+item.name+iStyleX.tagClosing; if (_form==2 && item.type!=flagInfo) {
itemIt="<nobr>"+itemIt+"</nobr>";
barWidth+=(getLength(itemIt)-_width);
}
} if (item.type!=flagInfo) {
itemIt='<a href="'+((item.type==flagCommand || item.type==flagImageCommand)?'#" onclick="'+item.value+';return false;':item.value)+'" onMouseOver="'+((item.type!=flagMenu && item.type!=flagImageMenu)?item.onCodes:'')+';window.status='+"'"+item.help+"'"+';return true;"'+((item.type!=flagMenu && item.type!=flagImageMenu)?(' onMouseOut="'+item.outCodes+'"'):'')+((item.type==flagCommand || item.type==flagImageCommand)?'':instance.target)+'>'+itemIt+'</a>';
} paddingRow=(iStyle.paddingHeight==0)?'':('<tr align="left" valign="top"><td colspan="'+paddingSpan+'" width="'+barWidth+'" height="'+iStyle.paddingHeight+'">'+pixelImage+'</td></tr>'); itemBar='<table align="left" width="'+barWidth+'" cellpadding="0" cellspacing="0" border="0">'+paddingRow+'<tr align="'+((_form==0)?((instance.direction==0||instance.direction==3)?"left":"right"):"center")+'" valign="middle">'+((instance.direction==0||instance.direction==3)?'':tagContent)+iStyleX.paddingCol+'<td width="'+_width+'">'+itemIt+'</td>'+iStyleX.paddingCol+((instance.direction==0||instance.direction==3)?tagContent:'')+'</tr>'+paddingRow+'</table>';
} this.layer=makeLayer(barWidth,itemBar,iStyle.colorNormal,_index,holder); this.layer.instance=this.instance;
this.layer.type=item.type;
this.layer.help=(item.type==flagSeparator || item.type==flagInfo)?"":item.help;
this.layer.focused=false;
this.layer.active=_active;
this.layer.dy=0; this.layer.colorHighlighted=iStyle.colorHighlighted; this.layer.colorNormal=iStyle.colorNormal; if (item.type==flagImageLink || item.type==flagImageMenu || item.type==flagImageCommand) {
this.layer.initial=iStyle.imagePath+item.initial; this.layer.swapping=iStyle.imagePath+item.swapping;
this.layer.imageName=imageName;
} this.layer.onmouseover=overItem;
this.layer.onmouseout=outIt;
this.layer.turnColor=turnIt; this.width=barWidth;
this.height=(isIE4)?(this.layer.children[0].offsetHeight):(this.layer.document.height);
}function makePad(_index,_active,_level) {
var instance=yxI[this.instance],iStyle=instance.style[_level],holder=instance.holder;
var menuPad=(iStyle.borderOn && iStyle.spacing>0)?('<table align="left" width="'+this.width+'" height="'+this.height+'" cellspacing="0" cellpadding="0" border="0"><tr align="left" valign="top"><td bgcolor="'+iStyle.borderColorBright+'" width="1" height="'+(this.height-1)+'" rowspan="2">'+pixelImage+'</td><td bgcolor="'+iStyle.borderColorBright+'" width="'+(this.width-2)+'" height="1">'+pixelImage+'</td><td bgcolor="'+iStyle.borderColorDark+'" width="1" height="'+(this.height-1)+'" rowspan="2">'+pixelImage+'</td></tr><tr align="left" valign="top"><td width="'+(this.width-2)+'" height="'+(this.height-2)+'">'+pixelImage+'</td></tr><tr align="left" valign="top"><td bgcolor="'+iStyle.borderColorDark+'" width="'+this.width+'" height="1" colspan="3">'+pixelImage+'</td></tr></table>'):('<table align="left" width="'+this.width+'" height="'+this.height+'" cellpadding="0" cellspacing="0" border="0"><tr><td>'+pixelImage+'</td></tr></table>'); this.layer=makeLayer(this.width,menuPad,iStyle.spacingColor,_index,holder); this.layer.instance=this.instance;
this.layer.active=_active; this.layer.onmouseover=overPad;
this.layer.onmouseout=outIt;
}function makeMenu(_x,_y,_menu,_index,_form,_upper,_level) {
var instance=yxI[this.instance],iStyle=instance.style[_level],direction=instance.direction;
var items=_menu.items,itemCount=items.length;
var useTag=false; for (var i=0; i<itemCount; i++) {
if (items[i].type==flagMenu || items[i].type==flagImageMenu) {
useTag=(items[i].tag=="")?(iStyle.tagOn&&_form==0):((items[i].tag=="0")?false:true);
if (useTag) { break; }
}
} var itemWidth=Math.floor(_menu.width*iStyle.widthRatio/100);
if (_form==0) {
this.pad.width=itemWidth+(iStyle.paddingWidth+iStyle.spacing)*2+((useTag)?iStyle.tagWidth:0);
this.pad.height=iStyle.spacing*2;
}
else {
this.pad.width=iStyle.spacing*2;
} for (var i=0; i<itemCount; i++) {
this.items[i]=new itemOBJ(this.instance,items[i].type);
this.items[i].makeItem(items[i],useTag,itemWidth,_index+1,_form,this.initial,_level); if (_form==0) {
this.pad.height+=this.items[i].height;
}
else {
if (this.pad.height<(this.items[i].height+iStyle.spacing*2)) { this.pad.height=this.items[i].height+iStyle.spacing*2; }
this.pad.width+=this.items[i].width;
}
} this.pad.makePad(_index,this.initial,_level); this.pad.x=_x-((direction==1||direction==2)?this.pad.width:0);
this.pad.y=_y-((direction==2||direction==3)?this.pad.height:0); this.pad.movePad(this.pad.x,this.pad.y); if (isNN4) {
this.pad.pminX=_upper.minX; this.pad.pminY=_upper.minY;
this.pad.pmaxX=_upper.maxX; this.pad.pmaxY=_upper.maxY; this.pad.minX=(_upper.minX>this.pad.x)?this.pad.x:_upper.minX;
this.pad.minY=(_upper.minY>this.pad.y)?this.pad.y:_upper.minY;
this.pad.maxX=(_upper.maxX<this.pad.x+this.pad.width)?(this.pad.x+this.pad.width):_upper.maxX;
this.pad.maxY=(_upper.maxY<this.pad.y+this.pad.height)?(this.pad.y+this.pad.height):_upper.maxY;
} var itemX=this.pad.x+iStyle.spacing,itemY=this.pad.y+iStyle.spacing,subX=0,subY=0;
for (var i=0; i<itemCount; i++) {
this.items[i].layer.peer=this.items;
this.items[i].x=itemX; this.items[i].y=itemY;
this.items[i].moveItem(itemX,itemY); if (items[i].type==flagMenu || items[i].type==flagImageMenu) {
if (_form==0) {
subX=itemX+((direction==0||direction==3)?(this.items[i].width):0);
subY=itemY+((direction==0||direction==1)?(-iStyle.spacing):(this.items[i].height+iStyle.spacing));
}
else {
subX=itemX+((direction==0||direction==3)?(-iStyle.spacing):(this.items[i].width+iStyle.spacing));
subY=itemY+((direction==0||direction==1)?(this.pad.height-iStyle.spacing):(-iStyle.spacing));
} this.items[i].menu.makeMenu(subX,subY,items[i].menu,_index+2,0,this.pad,1);
this.items[i].layer.menu=this.items[i].menu;
}
else if (items[i].type==flagSeparator) {
makeSeparator(this.items[i],this.pad.width,this.pad.height,_form,iStyle);
} if (_form==0) {
itemY+=this.items[i].height;
}
else {
itemX+=this.items[i].width; if (isIE4) {
this.items[i].layer.style.height=this.pad.height-iStyle.spacing*2;
}
else {
this.items[i].layer.clip.height=this.pad.height-iStyle.spacing*2;
}
}
}
}function showMenu(_dy) {
var instance=yxI[this.instance],holder=instance.holder,pad=this.pad,items=this.items,itemCount=items.length;
var padTop=holder.dy+this.pad.y,padBottom=padTop+this.pad.height; if (this!=instance.menu) {
var dy=0,scrollY=(isNN4)?window.pageYOffset:window.document.body.scrollTop; if (isNN4) {
this.clipX=holder.clip.left; this.clipY=holder.clip.top;
this.clipWidth=holder.clip.width; this.clipHeight=holder.clip.height;
} if (instance.direction==0||instance.direction==1) {
if (padBottom+_dy-scrollY>contentHeight) {
dy=contentHeight+scrollY-padBottom;
if (padTop+dy<scrollY) { dy=scrollY-padTop; }
}
else {
dy=_dy;
}
if (isNN4) { setClip(holder,pad.minX,pad.minY+dy,pad.maxX,pad.maxY); }
}
else {
dy=(padTop+_dy<scrollY)?scrollY-padTop:_dy;
if (isNN4) { setClip(holder,pad.minX,pad.minY,pad.maxX,pad.maxY+dy); }
}
if (pad.dy!=dy) {
pad.movePad(pad.x,pad.y+dy); pad.dy=dy;
for (var i=0; i<itemCount; i++) {
items[i].moveItem(items[i].x,items[i].y+dy);
items[i].layer.dy=dy;
}
}
}
else if (isNN4) {
setClip(holder,pad.minX,pad.minY,pad.maxX,pad.maxY);
} pad.showPad();
for (var i=0; i<itemCount; i++) { items[i].showItem(); } this.shown=true;;
}function hideMenu() {
var items=this.items,pad=this.pad; if (this.initial) {
blurIt(items);
}
else {
var itemCount=items.length;
for (var i=0; i<itemCount; i++) {
if (items[i].type==flagMenu || items[i].type==flagImageMenu) {
if (items[i].menu.shown) { items[i].menu.hideMenu(); }
} items[i].hideItem();
items[i].layer.turnColor(false);
} pad.hidePad();
if (isNN4) { setClip(yxI[this.instance].holder,this.clipX,this.clipY,this.clipX+this.clipWidth,this.clipY+this.clipHeight); }
} this.shown=this.initial;
}function makeInstance() { this.menu.makeMenu(this.x,this.y,this.group.menu,1,this.form,this,0); }function showInstance() {
clearTimer(this.instance); this.holder.css.zIndex=++lastIndex; if (!this.shown) {
this.menu.showMenu(0);
this.shown=true;
}
else {
blurIt(this.menu.items);
} lastInstance=this.instance;
}function hideInstance() {
clearTimer(this.instance);
window.status=""; if (this.shown) {
this.menu.hideMenu();
this.shown=this.initial;
this.holder.css.zIndex=1;
}
}function moveInstanceTo(_x,_y) {
clearTimer(this.instance);
moveLayerTo(this.holder,_x,_y); this.holder.xx=_x; this.holder.yy=_y; this.holder.dy=getTop(this.holder);
}function moveInstanceBy(_x,_y) {
clearTimer(this.instance); moveLayerBy(this.holder,_x,_y);
this.holder.xx+=_x; this.holder.yy+=_y; this.holder.dy=getTop(this.holder);
}function checkInstance() { eval('setInterval("_checkInstance('+this.instance+')",'+menuTimer+')'); }function registerPop() {
popInstance=this.instance; if (isIE4) {
window.document.ondblclick=popMenu;
}
else {
window.document.onDblClick=popMenu;
window.document.captureEvents(Event.DBLCLICK);
}
}function registerMap() {
if (isIE4) {
window.document.onclick=mapMenu;
}
else {
window.document.onClick=mapMenu;
window.document.captureEvents(Event.CLICK);
}
}// ------
function turnIt(_mode) {
if (this.type==flagImageLink || this.type==flagImageMenu || this.type==flagImageCommand) {
this.document.images[this.imageName].src=(_mode)?this.swapping:this.initial;
}
else {
if (isIE4) {
this.style.backgroundColor=(_mode)?this.colorHighlighted:this.colorNormal;
}
else {
this.bgColor=(_mode)?this.colorHighlighted:this.colorNormal;
}
} this.focused=_mode;
}function overItem() {
var instance=yxI[this.instance]; clearTimer(this.instance); if (lastInstance!=this.instance && lastInstance!=-1) { yxI[lastInstance].hideInstance(); } if (this.active && instance.holder.css.zIndex<lastIndex) { instance.holder.css.zIndex=++lastIndex; } lastInstance=this.instance; if (this.focused) {
if (this.type==flagMenu || this.type==flagImageMenu) { blurIt(this.menu.items); }
}
else {
blurIt(this.peer);
} if (this.type!=flagSeparator && this.type!=flagInfo) {
this.turnColor(true);
window.status=this.help;
} if (this.type==flagMenu || this.type==flagImageMenu) { this.menu.showMenu(this.dy); }
}function overPad() {
var instance=yxI[this.instance]; clearTimer(this.instance); if (lastInstance!=this.instance && lastInstance!=-1) { yxI[lastInstance].hideInstance(); } if (this.active && instance.holder.css.zIndex<lastIndex) { instance.holder.css.zIndex=++lastIndex; } lastInstance=this.instance;
}function outIt() { _hideInstance(this.instance); }// ------
function initGroup(_group) {
checkBrowser(); if (isIE4 || isNN4) {
setParameter(); yxGroup=getArray(_group);
if (yxGroup) {
setTimeout("_initGroup()",0);
}
else {
showError("Menu Group Not Found: ["+_group+"]");
}
}
else {
showError("Sorry,you are not using IE4+ or NN4+");
}
}// ------
function addStyle(_styleName,_paddingWidth,_paddingHeight,_spacing,_spacingColor,_colorNormal,_colorHighlighted,_border,_borderColorBright,_borderColorDark,_textFont,_textSize,_textWeight,_textDecoration,_textColor,_tag,_tagWidth,_tagHeight,_tagImage,_imagePath,_widthRatio) {
_addStyle(_styleName,_paddingWidth,_paddingHeight,_spacing,_spacingColor,_colorNormal,_colorHighlighted,_border,_borderColorBright,_borderColorDark,_textFont,_textSize,_textWeight,_textDecoration,_textColor,_tag,_tagWidth,_tagHeight,_tagImage,_imagePath,_widthRatio);
}function addInstance(_name,_type,_position,_holder,_x,_y,_direction,_form,_initial,_target,_group,_style1,_style2) {
_addInstance(_name,_type,_position,_holder,_x,_y,_direction,_form,_initial,_target,_group,_style1,_style2);
}function addFrame(_name) { return; }function openMap(_fName,_iName) { return _openMap(_iName); }
function openMenu(_fName,_iName) { return _openMenu(_iName); }
function closeMenu(_fName,_iName) { return _closeMenu(_iName); }
function closeMenuNow(_fName,_iName) { return _closeMenuNow(_iName); }
function switchMenu(_fName,_iName) { return _switchMenu(_iName); }
function moveMenuTo(_fName,_iName,_x,_y) { return _moveMenuTo(_iName,_x,_y); }
function moveMenuBy(_fName,_iName,_x,_y) { return _moveMenuBy(_iName,_x,_y); }
function getMenuDim(_fName,_iName) { return _getMenuDim(_iName); }
function getItemDim(_fName,_iName,_iIndex) { return _getItemDim(_iName,_iIndex); }
-------------------------------------function openwinnews(){
window.open("../daynews.htm","","top=10,left=100,width=360,height=10")
}function winop(html){
var ie = false;
var ns = false;
var popUpURL="mengxh"+html;
if(parseInt(navigator.appVersion) >= 4){
if(navigator.appName.indexOf("Microsoft") != -1) ie = true;
if(navigator.appName.indexOf("Netscape") != -1) ns = true;
}
if (ie){
var popUpSizeX=screen.width;
var popUpSizeY=screen.height;
var popUpLocationX=1;
var popUpLocationY=0;
var splashWin = window.open("",'','fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
splashWin.resizeTo(popUpSizeX,popUpSizeY);
splashWin.moveTo(popUpLocationX,popUpLocationY);
splashWin.location=popUpURL;
splashWin.focus();
}
if(ns){window.open(popUpURL,"_blank","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");}}function openwinweather(){
window.open("../wealther.htm","","top=10,left=100,width=160,height=100")
}var sample = new Array();
sample[0] = new Array("sampleA","sampleA","120");var sampleA = new Array();
sampleA[0] = new Array("M", "【孟宪会之精彩世界】导航菜单", "【孟宪会之精彩世界】导航菜单", "http://elove.heha.net", "sample11", "70", "0");var sample11 = new Array();
sample11[0] = new Array("M", "首页公告", "首页公告", "javascript:void(null)", "sample111","100","");
sample11[1] = new Array("S");
sample11[2] = new Array("M", "技术专页", "技术专页", "javascript:void(null)", "sample112","60","");
sample11[3] = new Array("S");
sample11[4] = new Array("M", "技术新闻", "技术新闻", "javascript:void(null)", "sample113","80","");
sample11[5] = new Array("S");
sample11[6] = new Array("M", "Flash 世界", "Flash 世界", "javascript:void(null)", "sample114","70","");
sample11[7] = new Array("S");
sample11[8] = new Array("M", "Java 世界", "Java 世界", "javascript:void(null)", "sample115","100","");
sample11[9] = new Array("S");
sample11[10] = new Array("M", "VRML世界", "VRML世界", "javascript:void(null)", "sample116","60","");
sample11[11] = new Array("S");
sample11[12] = new Array("M", "贴心服务", "贴心服务", "javascript:void(null)", "sample117","130","");
sample11[13] = new Array("S");
sample11[14] = new Array("M", "音乐无限", "音乐无限", "javascript:void(null)", "sample118","60","");
sample11[15] = new Array("S");
sample11[16] = new Array("M", "联系站长", "联系站长", "javascript:void(null)", "sample119","80","");
sample11[17] = new Array("S");
sample11[18] = new Array("L", "友情链接", "友情链接", "http://elove.heha.net/friend.htm", "", "");
var sample111 = new Array();
sample111[0] = new Array("C", "本站【香港站】", "打开【孟宪会之精彩世界】之香港站", "window.open('http://elove.heha.net')", "", "");
sample111[1] = new Array("S");
sample111[2] = new Array("C", "本站【上海站】", "打开【孟宪会之精彩世界】之上海站", "window.open('http://lucky.myrice.com')", "", "");
sample111[3] = new Array("S");
sample111[4] = new Array("C", "本站【北京站】", "打开【孟宪会之精彩世界】之北京站", "window.open('http://ctinamxh.at.china.com/')", "", "");
sample111[5] = new Array("S");
sample111[6] = new Array("C", "本站【海外站】", "打开【孟宪会之精彩世界】之海外站", "window.open('http://elove.no-frills.net')", "", "");
sample111[7] = new Array("S");
sample111[8] = new Array("C", "本站【51站】", "打开【孟宪会之精彩世界】之51站", "window.open('http://egirl.51.net')", "", "");
sample111[9] = new Array("S");
sample111[10] = new Array("L", "本站更新日志", "打开【孟宪会之精彩世界】之更新日志", "http://elove.heha.net/service/log.htm", "", "");var sample112 = new Array();
sample112[0] = new Array("L", "PHP 技术", "", "http://elove.heha.net/php.htm", "", "");
sample112[1] = new Array("S");
sample112[2] = new Array("L", "JSP 技术", "", "http://elove.heha.net/jsp.htm", "", "");
sample112[3] = new Array("S");
sample112[4] = new Array("L", "ASP 技术", "", "http://elove.heha.net/asp.htm", "", "");
sample112[5] = new Array("S");
sample112[6] = new Array("L", "WAP 技术", "", "http://elove.heha.net/wap.htm", "", "");
sample112[7] = new Array("S");
sample112[8] = new Array("L", "XML 技术", "", "http://elove.heha.net/xml.htm", "", "");var sample113 = new Array();
sample113[0] = new Array("L", "IT 技术新闻", "IT 技术新闻", "http://elove.heha.net/news.htm", "", "");
sample113[1] = new Array("S");
sample113[2] = new Array("C", "IT 滚动新闻", "IT 滚动新闻", "openwinnews()", "", "");var sample114 = new Array();
sample114[0] = new Array("L", "FLASH 作品", "", "http://elove.heha.net/flash.htm", "", "");
sample114[1] = new Array("S");
sample114[2] = new Array("L", "FLASH 软件", "", "http://lucky.myrice.com/flashsoft.htm", "", "");var sample115 = new Array();
sample115[0] = new Array("L", "JAVA 世界", "", "http://elove.heha.net/java/javaworld.html", "", "");
sample115[1] = new Array("S");
sample115[2] = new Array("L", "Javascript 精解", "", "http://elove.heha.net/javascriptexam/", "", "");
sample115[3] = new Array("S");
sample115[4] = new Array("L", "Dhtml 精解", "", "http://elove.heha.net/dhtml/", "", "");var sample116 = new Array();
sample116[0] = new Array("L", "VRML 例子", "", "http://elove.heha.net/vrml.htm", "", "");
sample116[1] = new Array("S");
sample116[2] = new Array("L", "VRML 资源", "", "http://elove.heha.net/vrmlsource.htm", "", "");var sample117 = new Array();
sample117[0] = new Array("L", "全国各大城市天气预报","", "openwinweather()", "", "");
sample117[1] = new Array("S");
sample117[2] = new Array("L", "香港地区详细天气预报", "", "http://www.yeahplaza.com/chinese", "", "");sample117[3] = new Array("S");
sample117[4] = new Array("C", "查看本页源代码", "", "window.location='view-source:'+window.location.href", "", "");
sample117[5] = new Array("S");
sample117[6] = new Array("L", "好站推荐", "", "http://elove.heha.net/goodsite.htm", "", "");var sample118 = new Array();sample118[0] = new Array("L", "无限歌词", "", "http://elove.heha.net/music/music1.htm", "", "");var sample119 = new Array();sample119[0] = new Array("L", "给我留言", "", "http://elove.heha.net/email.htm", "", "");
sample119[1] = new Array("S");
sample119[2] = new Array("L", "给我发E-mail", "", "mailto:[email protected]", "", "");
--------------------------
meng_style.js文件
----------------------------------
function buildMenu() {
addStyle("style0",6,3,3,"#669900","#38B878","#ffa020",1,"#f8f8f8","#ff0000","宋体",12,"bold","none","#003366",0,7,7,"tag1l.gif","http://elove.heha.net/tags/",100);
addStyle("style1",3,3,2,"#669900","#38B878","#ffa020",1,"#f8f8f8","#ff0000","宋体",12,"normal","none","#0000ff",1,7,7,"tag1l.gif","http://elove.heha.net/tags/",100); addInstance("【孟宪会之精彩世界】之导航菜单",3,4,"",0,0,2,2,1,"","sampleA","style0","style1"); addFrame("Main");
}-------------------------------------------
这是精品哦。好好保护利用。
http://go6.163.com/colorweb/music/music1.htm
http://www.cnvrml.org/