js弹出遮罩层【并弹出提示信息】


<HTML>
<body>
<script language="JavaScript">
function salert(str){
var msgw,msgh,bordercolor;
msgw=400;//提示窗口的宽度
msgh=100;//提示窗口的高度
titleheight=25 //提示窗口标题高度
bordercolor="#336699";//提示窗口的边框颜色
titlecolor="#99ccff";//提示窗口的标题颜色

var swidth,sheight;
swidth=document.body.offsetWidth;
sheight=document.body.offsetHeight;
if (sheight<screen.height)
{
sheight=screen.height;
}

var bgobj=document.createElement("div");
bgobj.setAttribute('id','bgdiv');
bgobj.style.position="absolute";
bgobj.style.top="0";
bgobj.style.background="#777";
bgobj.style.filter="progid:dximagetransform.microsoft.alpha(style=3,opacity=25,finishopacity=75";
bgobj.style.opacity="0.6";
bgobj.style.left="0";
bgobj.style.width=swidth + "px";
bgobj.style.height=sheight + "px";
bgobj.style.zindex = "10000";
document.body.appendChild(bgobj);

var msgobj=document.createElement("div")
msgobj.setAttribute("id","msgdiv");
msgobj.setAttribute("align","center");
msgobj.style.background="white";
msgobj.style.border="1px solid " + bordercolor;
msgobj.style.position = "absolute";
msgobj.style.left = "50%";
msgobj.style.top = "50%";
msgobj.style.font="12px/1.6em verdana, geneva, arial, helvetica, sans-serif";
msgobj.style.marginLeft = "-225px" ;
msgobj.style.marginTop = -75+document.documentElement.scrollTop+"px";
msgobj.style.width = msgw + "px";
msgobj.style.height =msgh + "px";
msgobj.style.textalign = "center";
msgobj.style.lineheight = (msgh-titleheight) + "px";
msgobj.style.zindex = "10001";

var title=document.createElement("h4");
title.setAttribute("id","msgtitle");
title.setAttribute("align","right");
title.style.margin="0";
title.style.padding="3px";
title.style.background=bordercolor;
title.style.filter="progid:dximagetransform.microsoft.alpha(startx=20, starty=20, finishx=100, finishy=100,style=1,opacity=75,finishopacity=100);";
title.style.opacity="0.75";
title.style.border="1px solid " + bordercolor;
title.style.height="18px";
title.style.font="12px verdana, geneva, arial, helvetica, sans-serif";
title.style.color="white";
title.style.cursor="pointer";
title.innerHTML="关闭";
title.onclick=function(){
document.body.removeChild(bgobj);
document.getElementById("msgdiv").removeChild(title);
document.body.removeChild(msgobj);
}
document.body.appendChild(msgobj);
document.getElementById("msgdiv").appendChild(title);
var txt=document.createElement("p");
txt.style.margin="1em 0"
txt.setAttribute("id","msgtxt");
txt.innerHTML=str;
document.getElementById("msgdiv").appendChild(txt);
}
salert("系统正在处理......请稍后");
</script>

</body>
</HTML>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值