点击一个按钮或一个连接,一个层浮在整个页面的上面,整个页面就像是被磨砂玻璃盖着一样的视觉效果,层下面的东西不能操作,只有层上面的可以操作类似这个页面选择人物时的效果http://in.sg.kunlun.com/template/nvvsafreet/?u=178&u2=qihu07大家有教程或者什么参考的麻烦给我发一下,谢谢了

解决方案 »

  1.   

    http://www.cnblogs.com/cloudgamer/archive/2008/09/15/1290954.html
    可以参考cloudgamer的
      

  2.   

    用div,设置zIndex、背景色及透明度
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>mask demo</title></head>
    <style type="text/css">
    <!--
    html, body { height:100%; margin:0; }
    #mask { position:fixed; left:0; top:0; width:100%; height:100%; background-color:gray; z-index:100; filter:alpha(opacity=50); opacity:0.5 }
    #app { position:absolute; left:200px; z-index:101; border: 1px solid red; background-color: #996; }
    -->
    </style>
    <body>
    <div id="app">
      <p>另外一些文字</p>
      <p>
        <input type="button" value="关闭" onclick="with(document){getElementById('mask').style.display=getElementById('app').style.display='none';}" />
      </p>
      <p><a href="#">另外一些链接</a></p>
    </div>
    <div id="mask"></div>
    <p>一些文字</p>
    <p>
      <input type="button" value="弹出" onclick="with(document){getElementById('mask').style.display=getElementById('app').style.display='';}" />
    </p>
    <p><a href="#">一些链接</a></p>
    </body>
    </html>
      

  4.   

    如果严格要求被覆盖的层不能被操作,请切记处理好Tab键切换。
      

  5.   

    两年前写的,贴给你<html>
        <head>
        <title>test div</title>
        <style>
                #dlg{
                        height: 200px;
                        width: 350px;
                        border: solid black 1px;
                }
                td{
                        padding: 5px;
                }
        </style>
        <style type="text/css">
            
        </style>
        <script language="javascript">
            //mask为遮盖层div,
            function showDialog(){
                var masklayer = document.all("mask") ;
                masklayer.style.width = screen.width ;
                masklayer.style.height = screen.height ;
                masklayer.style.display = "" ;
                var dlg = document.getElementById("dlg");
                dlg.style.display = "";
            }
            function hideDialog(){
                var masklayer = document.all("mask") ;
                masklayer.style.display = "none" ;
                var dlg = document.getElementById("dlg");
                dlg.style.display = "none";
            }
        function doEscape(){
            var masklayer = document.all("mask") ;
            var dlg = document.getElementById("dlg") ;
            if(masklayer.style.display==""||mask.style.display==""){
                if (event.ctrlKey){
                    alert("event.key") ;
                }
            }
        }
        </script>
        <body>
            <input type="submit" value="Show dialog" onClick="showDialog();">
            <div id="mask" name="mask" style="position:absolute;left:0px;top:0px;display:none;z-index:999;filter:alpha(opacity=40);background-color:silver"></div>
            <div id="dlg"  onkeydown="doEscape();" name="dlg" style="position:absolute;display:none;left:380px;top:250px;z-index:1000;border:1px;border-color:red">
            <table border=1 height="200" width="350" aligh="center" style="border-collapse:collapse;background-color:#eeeeee;"><tr><td>This is a customer dialog</td></tr><tr><td>
            <input type="submit" value="Close dialog" onClick="hideDialog();"></td></tr><tr><td></td></tr></table></div>
        </body>
    </html>
      

  6.   


    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body oncontextmenu = "return false">
    <div class="cecmbody" id="cecmpolicy">
          <div class="leftClass">
                 <p>测试</p>
           <input type="button" value="点击这里" onclick="sAlert('<a href=http://www.uxing.cn/>测试效果</a>');" />
      
          </div>
          <div class="rightClass">
          </div> 
    </div>
            <script type="text/javascript" language="javascript">       function sAlert(str){
           document.body.style.overflow = "hidden";
           var msgw,msgh,bordercolor;
           msgw=400;//提示窗口的宽度
           msgh=100;//提示窗口的高度
           titleheight=25 //提示窗口标题高度
           bordercolor="#336699";//提示窗口的边框颜色
           titlecolor="#99CCFF";//提示窗口的标题颜色
       
           var sWidth,sHeight;
           sWidth=document.body.offsetWidth;
           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 ="25px";
                      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.style.overflow = "auto";
                        }
             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);
                    }
          </script></body>
    </html>
      

  7.   

    刚学js时是把51job.com下来,按着做了一遍。有你想要的。
      

  8.   

    顶楼主,baidu搜下,N多的,主要思路是控制层的 上下关系 ,还有得到浏览器的坐标,