<html>
<head>
<title></title>
<style type="text/css">
#divshow
{
position: fixed; /*相对于浏览器窗口进行定位*/
left: 0px;
top: 0px;
width: 100%;
height: 100%;
opacity:0.6; /* 透明度*/
background:red;
display:none;
position:absolute; /*相对定位*/
z-index:999;
}
</style>
<script type="text/javascript">
function myfunction() {
document.getElementById("divshow").style.display = "block"
}
</script>
</head>
<body>
<div style=" left:0px; top:0px; width:100%; height:100%;">
<input type="button" id="btn" value="你好!" onclick="myfunction()" />
</div>
<div id="divshow">
<div style=" width:300px; height:200px; left:50%; top:50%; position:relative; background-color:Gray; margin-left:-150px; margin-top:-100px;" >你妹的</div>
</div>
</body>
</html>