如题 
    谁有相关代码给我 感激不尽

解决方案 »

  1.   

    jQuery+jQuery插件. 又多又漂亮.
      

  2.   


    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="PopDiv.aspx.cs" Inherits="PopDiv" %><!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 runat="server">
        <title>无标题页</title>
        <script type="text/javascript" src="../JS/JScript.js"></script>
        <link rel="stylesheet" href="../CSS/control.css" />
    </head>
    <body style="height:100%">
        <form id="form1" runat="server">
        <div>
            <asp:Button ID="Button1" runat="server" Text="Button" />
            <input id="Button2" type="button" value="模拟DIV弹出窗口" onclick="ShowDiv('light');ShowDiv('fade');"/>
        </div>
        <div id="light" class="white_content">
            这里是弹出窗口内容.
            <a href="javascript:void(0)" onclick="HideDiv('light');HideDiv('fade');">
             Close</a>
        </div>
        <div id="fade" class="black_overlay" >
        </div>
        </form>
    </body>
    </html>
      

  3.   

    补充4楼
    //显示DIV
    function ShowDiv(id)
    {
       var div=document.getElementById(id);
       div.style.display='block';
    }//隐藏DIV
    function HideDiv(id)
    {
       var div=document.getElementById(id);
       div.style.display='none';
    }//显示/隐藏DIV
    function OpDiv(id)
    {
        var div=document.getElementById(id);
        if(div.style.display=='block')
        {
            div.style.display='none';
        }
        else
        {
            div.style.display='block';
        }
    }
      

  4.   

    给个小例子你<%@ Page Language="C#" %>
    <!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 runat="server">
        <title>弹出层</title>
        <style type="text/css">
        html,body{height:100%;width:100%}
        </style>
    </head>
    <body >
        <form id="form1" runat="server">
            <input onclick="tan()" type="button" value="弹出层" />
        </form>
    </body>
    </html>
    <script type="text/javascript">
    function tan()
    {
        var d=document.createElement("div");
        d.id="bg"
        with(d.style){
        position="absolute";
        left=0;
        top=0;
        background="black";
        filter="Alpha(Opacity=60)"
        opacity=0.6
        width="100%"
        height="100%"
        }
        document.body.appendChild(d);
        d.onclick=function(){document.body.removeChild(document.getElementById('bg'))}
    }
    </script>top,left设置弹出层的位置,filter设置弹出层的透明度,opacity也是设置透明度(用来兼容火孤),position设置DIV为浮动的
    其实你只要把这个例子看懂了,你就可以弹出任何内容的层