发新话题
打印

弹出的层居中显示

弹出的层居中显示

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>弹出的层居中显示</title>
<meta name="generator" content="editplus">
<meta name="author" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<script language="javascript" type="text/javascript">
function divcenter()
{
var divId=document.getElementById('mxh');
document.getElementById('mxh').style.display="";
divId.style.left=(document.body.clientWidth-divId.clientWidth)/2+document.body.scrollLeft;
divId.style.top=(document.body.clientHeight-divId.clientHeight)/2+document.body.scrollTop;
}
</script>
</head>

<body>
<table width=100% bgcolor="#CCCCCC">
<tr><td><span>test</span></td></tr>
<tr><td><span>test</span></td></tr>
<tr><td><span>test</span></td></tr>
<tr><td><span>test</span></td></tr>


</table>
<div id=mxh style="position:absolute;left:200px;top:30px;width:200px;height:200px;background-color:navy;border:2px; display:none">我是居中显示的了。</div>
</body>
</html>

TOP

.

提示: 作者被禁止或删除 内容自动屏蔽

TOP

发新话题