📄 dhlayer.js
字号:
//定义popupMenu类
function dhlayer(){
//author:dh20156
this.content = null;
this.background = "buttonface";
this.border = "none";
this.fontSize = "12px";
this.padding = "2px;"
this.cursor = "default";
//popupMenu childNodes
this.childNodes = new Array();
//popupMenu body
this.body = null;
//定义popupMenu方式
var layer = document.createElement("DIV");
//popupMenu的显示方法,参数w-width(popupMenu宽),h-height(popupMenu高),o-parent Object(popupMenu的父对象)
this.show = function(l,t,w,h,o){
l = l+"px";
t = t+"px";
w = w+"px";
h = h+"px";
//应用IFRAME以遮蔽顶层对象
var ifr = document.createElement("IFRAME");
ifr.style.width = "100%";
ifr.style.height = "100%";
ifr.style.border = "none";
ifr.style.zIndex = "-1";
ifr.style.position = "absolute";
ifr.style.top = "0px";
ifr.style.left = "0px";
//应用DIV以遮蔽IFRAME的右键
var il = document.createElement("DIV");
il.id = "dhlayercontent";
il.style.width = w;
il.style.height = h;
il.style.overflowX = "hidden";
il.style.overflowY = "auto";
il.style.border = this.border;
il.style.background = this.background;
il.style.zIndex = "100";
il.style.position = "absolute";
il.style.top = "0px";
il.style.left = "0px";
il.style.padding = this.padding;
il.style.fontSize = this.fontSize;
il.innerHTML = this.content;
il.style.cursor = this.cursor;
layer.id = "dhlayer";
layer.style.padding = "0px";
layer.style.background = this.background;
layer.style.border = "none";
layer.style.zIndex = "1";
layer.style.width = w;
layer.style.height = h;
layer.style.position = "absolute";
layer.style.left = l;
layer.style.top = t;
layer.appendChild(ifr);
layer.appendChild(il);
if(document.getElementById("dhlayer")!=null){
o.replaceChild(layer,document.getElementById("dhlayer"));
}else{
o.appendChild(layer);
}
this.childNodes = il.childNodes;
this.body = il;
}
//popupMenu hide
this.hide = function(){
layer.style.display = "none";
}
if(document.all){
document.attachEvent("onclick",this.hide);
}else{
document.addEventListener("click",this.hide,true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -