在母版页中层的弹出
以下是我的代码 大家帮我看看 我在普通的页面中能正常实现,但是一到母版页中就不能实现层的弹出效果了?程序代码:
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Location.Master" AutoEventWireup="true" CodeBehind="AddNew.aspx.cs" Inherits="khfycn.admin.AddNew" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <style type="text/css"> body{margin:0;padding:0;} #bg{background:#000;position:absolute;left:0;top:0;filter:"Alpha(opacity=20)";opacity:0.2;display:none;} #win{width:500px;height:500px;position:absolute;left:50%;top:50%;margin:-100px -100px 0;border:4px #F00 solid;background:#FFF;display:none;} </style> <script type="application/javascript"> var $ = function (id) { return document.getElementById(id); } function WinTip() { var win = new WinSize(); var Tip = $("bg"); Tip.style.width = win.W + "px"; Tip.style.height = win.H + "px"; if (Tip.style.display == "block") { Tip.style.display = "none"; $("win").style.display = "none"; } else { Tip.style.display = "block"; $("win").style.display = "block"; } } function WinSize() //函数:获取尺寸 { var winWidth = 0; var winHeight = 0; if (window.innerWidth) winWidth = window.innerWidth; else if ((document.body) && (document.body.clientWidth)) winWidth = document.body.clientWidth; if (window.innerHeight) winHeight = window.innerHeight; else if ((document.body) && (document.body.clientHeight)) winHeight = document.body.clientHeight; if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) { winHeight = document.documentElement.clientHeight; winWidth = document.documentElement.clientWidth; } return { "W": winWidth, "H": winHeight } } </script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <div style="float:left; width:35px"> <a onclick="WinTip()" href="javascript:;"><img alt="打开" src="img/button_02.png" width="35px" height="26px" border="0" /></a> <div id="bg" style="DISPLAY: none;" > <div id="win"> <a href="javascript:;" onclick="WinTip()">关闭</a> <iframe src="pic.aspx" frameborder="0" scrolling="no" width="1000" height="100"></iframe> </div> </div> </div> </asp:Content>
请大家帮我看看 在母版页中怎么弄呢?