复制代码代码如下:
<! 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">
<adal>
<meta http-equiv = "contenu-type" contenu = "text / html; charset = utf-8" />
<Title> 简易弹出框 </TITAL>
<style type = "text / css">
.mydiv {
Color d'arrière-plan: # FF6;
Border: 5px solide # f90;
Texte-aligne: Centre;
hauteur de ligne: 40px;
taille de police: 12px;
Police-poids: Bold;
Z-Index: 99;
Largeur: 300px;
hauteur: 120px;
Gauche: 50%; / * ff ie7 * /
en haut: 50%; / * ff ie7 * /
marge-gauche: -150px! IMPORTANT; / * ff ie7 * /
marge: -60px! importante; / * ff ie7 * /
marge: 0px;
Position: fixe! importante; / * ff ie7 * /
Position: Absolute; / * ie6 * /
_top: Expression (EVAL (document.compatmode &&
document.compatMode == 'CSS1Compat')?
documentElement.scrollTop + (document.DocumentElement.ClientHeight-This.offsetheight) / 2: / * ie6 * /
document.body.scrolltop + (document.body.clientHeight - this.clientHeight) / 2); / * ie5 ie5.5 * /
}
.bg {
Color d'arrière-plan: #ccc;
Largeur: 100%;
hauteur: 100%;
à gauche: 0;
en haut: 0; / * ff ie7 * /
Filtre: Alpha (opacité = 10); / * ie * /
Opacité: 0,8; / * ff * /
Z-Index: 1;
Position: fixe! importante; / * ff ie7 * /
Position: Absolute; / * ie6 * /
_top: Expression (EVAL (document.compatmode &&
document.compatMode == 'CSS1Compat')?
documentElement.scrollTop + (document.DocumentElement.ClientHeight-This.offsetheight) / 2: / * ie6 * /
document.body.scrolltop + (document.body.clientHeight - this.clientHeight) / 2); / * ie5 ie5.5 * /
}
/*La fin*/
</ style>
<script type = "text / javascript">
fonction showDiv () {
document.getElementById ('popdiv'). style.display = 'bloc';
document.getElementById ('bg'). style.display = 'block';
}
fonction closev () {
document.getElementById ('popdiv'). style.display = 'Aucun';
document.getElementById ('bg'). style.display = 'Aucun';
}
</cript>
</ head>
<body>
<div id = "popdiv" style = "affichage: aucun;"> <br/> 弹框内容 <br/>
<a href = "javascript: closev ()"> 关闭 </a> </div>
<div id = "bg" style = "affichage: aucun;"> </div>
<div style = "padding-top: 20px;">
<input type = "soumi" name = "" value = "点此弹框" onclick = "javascript: showdiv ()" />
</div>
</docy>
</html>