日期:2014-05-16  浏览次数:20370 次

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>  

?