I think everyone has done common functions such as mask layers, which can be implemented with css or jquery. The implementation methods are diverse. Here http://I will introduce the method I implemented in the project. Full-screen mask, some areas are operable, very practical. .
The effect is as follows:
js implementation part:
Copy the code code as follows:
<script type="text/javascript">
var myAlert = document.getElementById("alert");
var reg = document.getElementById("content").getElementsByTagName("a")[0];
reg.onclick = function() {
myAlert.style.background = "#e2ecf5";
myAlert.style.zIndex = "501";
myAlert.style.position = "absolute";
var signSpan = document.getElementById("signSpanId");
myAlert.style.top = signSpan.offsetTop;
myAlert.style.left = signSpan.offsetLeft;
mybg = document.createElement("div");
mybg.setAttribute("id", "mybg");
mybg.style.background = "#000";
mybg.style.width = "100%";
mybg.style.height = "100%";
mybg.style.position = "absolute";
mybg.style.top = "0";
mybg.style.left = "0";
mybg.style.zIndex = "500";
mybg.style.opacity = "0.3";
mybg.style.filter = "Alpha(opacity=30)";
document.body.appendChild(mybg);
//document.body.style.overflow = "hidden";
}
</script>
Page code:
Copy the code code as follows:
<!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=gb2312" />
</head>
<body>
<table align="center">
<tr>
<td style="font-size:28px; font-weight:bold">
<div id="content">
<a href="#">
Activate mask layer
</a>
</div>
</td>
<td style="vertical-align:top">
<div id="signSpanId" style="position:absolute;"></div>
<div id="alert" align="top">
<h4>
<span>
This is the highlighted area
</span>
</h4>
<p>
<label>
username
</label>
<input type="text" />
</p>
<p>
<label>
password
</label>
<input type="password" />
</p>
<p>
<input type="submit" value="Register" />
<input type="reset" value="Reset" />
</p>
</div>
</td>
<td>
<div>I am the third column</div>
</td>
</tr>
</table>
</body>
</html>