複製代碼代碼如下:
<! Doctype HTML公共“ - // W3C // DTD XHTML 1.0 Transitional // en”“” http://www.org/tr/tr/xhtml1/dtd/xhtml1-xhtml1-transitional.transitional.dtdd'>
<html xmlns =“ http://www.w3.org/1999/xhtml”>
<頭>
<meta http-equiv =“ content-type” content =“ text /html; charset = utf-8” />
<title>簡易彈出框</title>
<style type =“ text/css”>
.mydiv {
背景色:#ff6;
邊界:5px實心#f90;
文字平衡:中心;
線高:40px;
字體大小:12px;
字體重量:大膽;
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 =='css1 compat')?
紀錄Element.scrolltop +(Document.DocumentElement.ClientHeight-This.offsetheight)/2:/*IE6*/
document.body.scrolltop +(document.body.clientheight -this.clientheight)/2);/*IE5 IE5.5*/
}
.bg {
背景色:#ccc;
寬度:100%;
身高:100%;
左:0;
頂部:0;/*ff IE7*/
過濾器:alpha(不透明度= 10);/*IE*/
不透明度:0.8;/*ff*/
z索引:1;
位置:固定!重要;/*ff IE7*/
位置:絕對;/*IE6*/
_top:expression(eval(document.compatmode &&
document.compatmode =='css1 compat')?
紀錄Element.scrolltop +(Document.DocumentElement.ClientHeight-This.offsetheight)/2:/*IE6*/
document.body.scrolltop +(document.body.clientheight -this.clientheight)/2);/*IE5 IE5.5*/
}
/*結束*/
</style>
<腳本類型=“ text/javascript”>
函數showdiv(){
document.getElementById('popdiv')。 style.display ='block';
document.getElementById('bg')。 style.display ='block';
}
函數lossiv(){
document.getElementById('popdiv')。 style.display ='none';
document.getElementById('bg')。 style.display ='none';
}
</script>
</head>
<身體>
<div id =“ popdiv” style =“ display:none;”> <br/> <br/>
<a href =“ javaScript:oflectiv()”>關閉</a> </div>
<div ID =“ bg”樣式=“ display:none;”> </div>
<div style =“ padding-top:20px;”>
<input type =“ submit” name =“” value =“點此彈框” onclick =“ javascript:showdiv()” />
</div>
</body>
</html>