HTML frameset弹DIV问题
发布网友
发布时间:2022-04-21 04:05
我来回答
共2个回答
热心网友
时间:2022-04-21 05:35
<html>
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js弹出蒙层</title>
</head>
<body>
<form id="form1" runat="server">
<div id="divTest" style="position: absolute; z-index: 3; width: 410px; height: 170px;
background-color: Yellow; display: none; top: 100px; left: 100px;">
<div id="dd" style="background-color: Red; width: 365px; height: 20px; float: left;"
onmousedown="down()">
这是标题,可拖动
</div>
<div style="background-color: Red; width: 35px; height: 20px;">
<a onClick="closes()">关闭</a>
</div>
</div>
<div id="ly" style="position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777;
z-index: 2; left: 0px; display: none;">
</div>
<div id="main" style="background-color: Azure; height:700px;">
<div>
<a onClick="show()">弹出蒙层</a>
</div>
<div>
</div>
<br />
</div>
</form>
<script type="text/javascript">
function show()
{
document.all.ly.style.display="block";
document.all.ly.style.width=document.body.clientWidth+20;
document.all.ly.style.height=document.body.clientHeight+20;
document.all.divTest.style.display='block';
document.getElementById("divTest").style.visibility="visible";
}
function closes()
{
if(window.confirm("关闭这个层"))
{
document.getElementById("divTest").style.visibility="hidden";
document.all.ly.style.display='none'
}
}
var px=0;
var py=0;
var begin=false;
var topDiv;
function down()
{
begin=true;
document.getElementById("divTest").style.cursor= "hand";
event.srcElement.setCapture();
px=document.getElementById("divTest").style.pixelLeft - event.x;
py=document.getElementById("divTest").style.pixelTop - event.y;
}
function document.onmousemove()
{
if(begin)
{
document.getElementById("divTest").style.pixelLeft = px+event.x;
document.getElementById("divTest").style.pixelTop = py+event.y;
}
}
function document.onmouseup()
{
begin=false;
document.getElementById("divTest").style.cursor= "default";
event.srcElement.releaseCapture();
}
</script>
</body>
</html>
热心网友
时间:2022-04-21 06:53
在header.jsp的JS里添加window.parent.div显示