<html>
<head>
<style type="text/css">
<!--
#addNotebook{
position:absolute;
top:0px;
left:0px;
display:none;
z-Index:1001;
vertical-align:middle;
padding:10px;
color:#000000;
background-color: #FFFFFF;
border:#6080ac 3px solid;
}
.opaqueLayer {
display:none;
position:absolute;
top:0px;
left:0px;
opacity:0.6;
filter:alpha(opacity=60);
background-color: #ADADAD;
z-Index:1000;
}
-->
</style>
<script type="text/javascript">
function getBrowserHeight() {
var intH = 0;
var intW = 0;
if(typeof window.innerWidth == 'number' ) {
intH = window.innerHeight;
intW = window.innerWidth;
}
else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
intH = document.documentElement.clientHeight;
intW = document.documentElement.clientWidth;
}
else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
if(document.body.scrollHeight > document.body.clientHeight)
{
intH = document.body.scrollHeight;
intW = document.body.scrollWidth;
}
else
{
intH = document.body.clientHeight;
intW = document.body.clientWidth;
}
}
return { width: parseInt(intW), height: parseInt(intH) };
}
function getWidth(obj)
{
var w = obj.getOffsetWidth;
if (w == null || w == 0)
{
var sw = obj.style.width;
if (sw != null && sw.indexOf("px") > 0)
{
w = sw.substr(0, sw.indexOf("px"));
}
}
return parseInt(w);
}
function getHeight(obj)
{
var w = obj.getOffsetHeight;
if (w == null || w == 0)
{
var sw = obj.style.height;
if (sw != null && sw.indexOf("px") > 0)
{
w = sw.substr(0, sw.indexOf("px"));
}
}
return parseInt(w);
}
function setLayerPosition(id) {
var shadow = document.getElementById('shadow');
var question = document.getElementById(id);
var bws = getBrowserHeight();
shadow.style.width = bws.width + 'px';
shadow.style.height = bws.height + 'px';
//document.body.style.overflow = 'hidden';
question.style.left = parseInt((bws.width - getWidth(question)) / 2);
question.style.top = parseInt((bws.height - getHeight(question)) / 3);
shadow = null;
question = null;
}
function showDialog(id)
{
setLayerPosition(id);
var shadow = document.getElementById('shadow');
var question = document.getElementById(id);
shadow.style.display = 'block';
question.style.display = 'block';
shadow = null;
question = null;
}
function hideLayer() {
var shadow = document.getElementById('shadow');
var add = document.getElementById('addNotebook');
shadow.style.display = 'none';
add.style.display = 'none';
//document.body.style.overflow = 'auto';
shadow = null;
add = null;
del = null;
}
</script>
</head>
<body>
<input type="button" name="show" value="点我" onclick="showDialog('addNotebook');">
<div id="addNotebook" style="width: 350px;height: 150px;">
<img src="tback.bmp">
<input type="button" value="再点" onclick="hideLayer();">
</div>
<div id="shadow" class="opaqueLayer"></div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>
评论0