当前位置:编程学习 > C#/ASP.NET >>

弹出半透明层

  如题 
    谁有相关代码给我 感激不尽 --------------------编程问答-------------------- 看看这里吧
希望对你有用 --------------------编程问答-------------------- jQuery+jQuery插件. 又多又漂亮. --------------------编程问答-------------------- 使用Jquery,自己看语法,也可以很容易写得出来的.
--------------------编程问答--------------------

<%@ 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>

--------------------编程问答-------------------- 补充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';
    }
} --------------------编程问答-------------------- 很多地方有   不要做的太复杂了 
--------------------编程问答--------------------    在哪里找啊  --------------------编程问答-------------------- 搜搜,有县城的。 --------------------编程问答-------------------- 给个小例子你

<%@ 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为浮动的
其实你只要把这个例子看懂了,你就可以弹出任何内容的层
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,