原生JavaScript遮罩
程序员文章站
2023-08-31 10:06:29
/* 适用原生JS */ function showInfo(info) { var zzInfo = info; var mask_bg = document.createElement("div"); mask_bg.id = "mask_bg"; mask_bg.style.position ......
/*
适用原生js
*/
function showinfo(info) {
var zzinfo = info;
var mask_bg = document.createelement("div");
mask_bg.id = "mask_bg";
mask_bg.style.position = "absolute";
mask_bg.style.top = "0px";
mask_bg.style.left = "0px";
mask_bg.style.width = "100%";
mask_bg.style.height = "100%";
mask_bg.style.backgroundcolor = "white";
mask_bg.style.filter='alpha(opacity:'+10+')';
mask_bg.style.opacity = 0.6;
mask_bg.style.zindex = 10001;
document.body.appendchild(mask_bg);
var mask_msg = document.createelement("div");
mask_msg.style.position = "absolute";
mask_msg.style.top = "30%";
mask_msg.style.left = "25%";
mask_msg.style.backgroundcolor = "black";
mask_msg.style.color = "white";
mask_msg.style.border = "#336699 0px solid";
mask_msg.style.textalign = "center";
mask_msg.style.fontsize = "2.1em";
mask_msg.style.fontweight = "bold";
mask_msg.style.filter='alpha(opacity:'+5+')';
mask_msg.style.padding = "0.5em 3em 0.5em 3em";
mask_msg.style.zindex = 10002;
mask_msg.innertext = ""+zzinfo+"";
mask_bg.appendchild(mask_msg);
}
下一篇: C语言程序设计100例之(1):鸡兔同笼