📄 xpmenu.js
字号:
/*--------------------------------------------------|
| 本作品取得原作者授权修改自 support@tops.com.cn |
| 的作品topflow |
| |
| 显示XP样式的主菜单,本文为第三方控件, |
| 主要来自WebMenuShop,如需使用,请参考相关资料 |
| |
| 版权归上海雪线信息技术有限公司所有, |
| 技术支持:sales@shcommit.com (仅对付费用户) |
| 网 站:www.shcommit.com |
| |
| 请勿私自拷贝、修改或用于商业用途 |
| 敬请保留本注释. |
| |
| Updated: 20070613 |
|--------------------------------------------------*/
var mmenus = new Array();
var misShow = new Boolean();
misShow = false;
var misdown = new Boolean();
misdown=false;
var musestatus = false;
var mpopTimer = 0;
mmenucolor = 'Menu';mfontcolor='MenuText';mmenuoutcolor='#CCCCFF';mmenuincolor='#CCCCFF';mmenuoutbordercolor='#000000';mmenuinbordercolor='#000000';mmidoutcolor='#AAAAAA';mmidincolor='#AAAAAA';mmenuovercolor='MenuText';mitemedge='0';msubedge='1';mmenuunitwidth=74;mmenuitemwidth=160;mmenuheight=30;mmenuwidth='100%';mmenuadjust=0;mmenuadjustV=-4;mfonts='font-family: Verdana; font-size: 8pt; color: MenuText; ';mcursor='default';
function mpopOut() {
mpopTimer = setTimeout('mallhide()', 500);
}
function getReal(el, type, value) {
temp = el;
while ((temp != null) && (temp.tagName != "BODY")) {
if (eval("temp." + type) == value) {
El = temp;
return el;
}
temp = temp.parentElement;
}
return el;
}
function mMenuRegister(menu)
{
mmenus[mmenus.length] = menu;
return (mmenus.length - 1);
}
function mMenuItem(caption,command,target,isline,statustxt,img,sizex,sizey,pos){
this.caption=caption;
this.command=command;
this.target=target;
this.isline=isline;
this.statustxt=statustxt;
this.img=img;
this.sizex=sizex;
this.sizey=sizey;
this.pos=pos;
}
function mMenu(caption,command,target,img,sizex,sizey,pos){
this.items = new Array();
this.caption=caption;
this.command=command;
this.target=target;
this.img=img;
this.sizex=sizex;
this.sizey=sizey;
this.pos=pos;
this.id=mMenuRegister(this);
}
function mMenuAddItem(item)
{
this.items[this.items.length] = item
item.parent = this.id;
this.children=true;
}
mMenu.prototype.addItem = mMenuAddItem;
function mtoout(src){
src.style.border='solid 1';
src.style.borderLeftColor=mmenuoutbordercolor;
src.style.borderRightColor=mmenuinbordercolor;
src.style.borderTopColor=mmenuoutbordercolor;
src.style.borderBottomColor=mmenuinbordercolor;
src.style.backgroundColor=mmenuoutcolor;
src.style.color=mmenuovercolor;
}
function mtoin(src){
src.style.border='solid 1';
src.style.borderLeftColor=mmenuinbordercolor;
src.style.borderRightColor=mmenuoutbordercolor;
src.style.borderTopColor=mmenuinbordercolor;
src.style.borderBottomColor=mmenuoutbordercolor;
src.style.backgroundColor=mmenuincolor;
src.style.color=mmenuovercolor;
}
function mnochange(src){
src.style.borderLeftColor=mmenucolor;
src.style.borderRightColor=mmenucolor;
src.style.borderTopColor=mmenucolor;
src.style.borderBottomColor=mmenucolor;
src.style.backgroundColor='';
src.style.color=mfontcolor;
src.style.border='solid 0';
}
function mallhide(){
for(var nummenu=0;nummenu<mmenus.length;nummenu++){
var themenu=document.all['mMenu'+nummenu];
var themenudiv=document.all['mmenudiv'+nummenu];
mnochange(themenu);
mmenuhide(themenudiv);
}
}
function mmenuhide(menuid){
menuid.style.visibility='hidden';
misShow=false;
}
function mmenushow(menuid,pid){
menuid.style.left=mposflag.offsetLeft+pid.offsetLeft+mmenuadjust;menuid.style.top=mposflag.offsetTop+mmenutable.offsetHeight+mmenuadjustV;
if(mmenuitemwidth+parseInt(menuid.style.left)>document.body.clientWidth+document.body.scrollLeft)
menuid.style.left=document.body.clientWidth+document.body.scrollLeft-mmenuitemwidth;
menuid.style.visibility='visible';
misShow=true;
}
function mmenu_over(menuid,x){
toel = getReal(window.event.toElement, "className", "coolButton");
fromel = getReal(window.event.fromElement, "className", "coolButton");
if (toel == fromel) return;
if(x==mmenus.length){
misShow = false;
mallhide();
mtoout(eval("mMenu"+x));
}else{
mallhide();
mtoin(eval("mMenu"+x));
mmenushow(menuid,eval("mMenu"+x));
}
clearTimeout(mpopTimer);
}
function mmenu_out(x){
toel = getReal(window.event.toElement, "className", "coolButton");
fromel = getReal(window.event.fromElement, "className", "coolButton");
if (toel == fromel) return;
if (misShow){
mtoin(eval("mMenu"+x));
}else{
mnochange(eval("mMenu"+x));
}
mpopOut()
}
function mmenu_down(menuid,x){
if(misShow){
mmenuhide(menuid);
mtoout(eval("mMenu"+x));
}
else{
mtoin(eval("mMenu"+x));
mmenushow(menuid,eval("mMenu"+x));
misdown=true;
}
}
function mmenu_up(){
misdown=false;
}
function mmenuitem_over(x,i){
srcel = getReal(window.event.srcElement, "className", "coolButton");
if(misdown){
mtoin(srcel);
}
else{
mtoout(srcel);
}
mthestatus = mmenus[x].items[i].statustxt;
if(mthestatus!=""){
musestatus=true;
window.status=mthestatus;
}
clearTimeout(mpopTimer);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -