复制代码代码如下:
<!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 = utf-8" />
<title>简易弹出框</title>
<style type = "text/css">
.mydiv {
バックグラウンドカラー:#ff6;
ボーダー:5pxソリッド#F90;
テキストアライグ:センター;
Line-Height:40px;
フォントサイズ:12px;
font-weight:bold;
z-index:99;
幅:300px;
高さ:120px;
左:50%;/*ff ie7*/
上:50%;/*ff ie7*/
マージン左:-150px!重要;/ *ff ie7 */
マージントップ:-60px!重要;/ *ff ie7 */
マージントップ:0px;
位置:修正!重要;/*ff ie7*/
位置:絶対;/*ie6*/
_top:expression(eval(document.compatmode &&
document.comPatMode == 'CSS1Compat')?
documentlement.scrolltop +(document.documentelement.clientheight-this.offseeth)/2:/*ie6*/
document.body.scrolltop +(document.body.clientheight -this.clientheight)/2);/*ie5 ie5.5*/
}
.bg {
バックグラウンドカラー:#ccc;
幅:100%;
高さ:100%;
左:0;
TOP:0;/*ff ie7*/
フィルター:アルファ(不透明= 10);/*ie*/
不透明度:0.8;/*ff*/
z-index:1;
位置:修正!重要;/*ff ie7*/
位置:絶対;/*ie6*/
_top:expression(eval(document.compatmode &&
document.comPatMode == 'CSS1Compat')?
documentlement.scrolltop +(document.documentelement.clientheight-this.offseeth)/2:/*ie6*/
document.body.scrolltop +(document.body.clientheight -this.clientheight)/2);/*ie5 ie5.5*/
}
/*終わり*/
</style>
<script type = "text/javascript">
関数showdiv(){
document.getElementById( 'popdiv')。style.display = 'block';
document.getElementById( 'bg')。style.display = 'block';
}
function closediv(){
document.getElementById( 'popdiv')。style.display = 'none';
document.getElementById( 'bg')。style.display = 'none';
}
</script>
</head>
<body>
<div id = "popdiv" style = "display:none;"> <br/>弹框内容<br/>
<a href = "javascript:clositiv()">关闭</a> </div>
<div id = "bg" style = "display:none;"> </div>
<div style = "padding-top:20px;">
<入力型= "submit" name = "" value = "" onclick = "javascript:showdiv()" />
</div>
</body>
</html>