<!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>兼容FF、IE 遮罩</title>
<meta http-equiv="Content-Type" content="text/HTML; charset=utf-8">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function divShow() {
//遮罩层
var sClientWidth = top.document.documentElement.scrollWidth;
var sClientHeight = top.document.documentElement.scrollHeight > top.document.documentElement.clientHeight ? top.document.documentElement.scrollHeight : top.document.documentElement.clientHeight;
$("#addDiv").css({ position: "absolute", display: "block", opacity: "0.2", filter: "alpha(opacity=40)", background: "#000", top: "0px", left: "0px", width: sClientWidth + "px", height: sClientHeight + "px" });
//最上层
$("#divShow").css({ zIndex: "2001", position: "absolute", left: (sClientWidth - 300) / 2 + "px", top: (sClientHeight-200)/2+"px" });
$("#divShow").show();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="button" onclick="divShow()" value="遮罩"/>
<div style="border: solid 1px; width: 300px; height: 150px; display: none; background-color: #ffffff;"
id="divShow">
<table>
<tr style="height: 30px; background-color: #7ABAFF;" id="t">
<td align="center" style="width: 300px; text-align: left;">
<b><asp:Label ID="lblText" runat="server" Text=""></asp:Label></b>
</td>
</tr>
<tr style="height: 40px;">
<td align="center">
<br />
公司名称:
<asp:TextBox ID="txtName" runat="server"></asp:TextBox><asp:RequiredFieldValidator
ID="RequiredFieldValidator2" runat="server" ErrorMessage="不能为空" ControlToValidate="txtName"></asp:RequiredFieldValidator>
</td>
</tr>
<tr style="height: 30px;">
<td align="center">
<br />
<asp:Button ID="btnSave" runat="server" Text=" 保 存 " />
<input type="button" id="btnReset" value=" 取 消 " />
</td>
</tr>
</table>
</div>
<div id="addDiv" style="display: none;">
</div>
</div>
</form>
</body>
</html>
兼容IE(6)、FF遮罩层处理
最新推荐文章于 2021-05-30 19:55:40 发布