การคัดลอกรหัสมีดังนี้:
<! 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 = gbk" /> >>
<tite> เอกสารชื่อ UNT </title>
<style type = "text/css">
/* สไตล์ของเลเยอร์ป๊อปอัพ*/
HTML, ร่างกาย {ความสูง: 100%; มาร์จิ้น: 0px; ขนาดตัวอักษร: 12px;}
.mydiv {
พื้นหลังสี: #ff6;
ชายแดน: 1px Solid #F90;
TEXT-ALIGN: CENTER;
สายไฟ: 40px;
ขนาดตัวอักษร: 12px;
Font-Weight: ตัวหนา;
z-index: 99;
ความกว้าง: 300px;
ความสูง: 120px;
ซ้าย: 50%;/*ff IE7*/
ด้านบน: 50%;/*ff IE7*/
ระยะขอบซ้าย: -150px! สำคัญ;/*ff ie7 ค่านี้ครึ่งหนึ่งของความกว้างของตัวเอง*/
ระยะขอบด้านบน: -60px! สำคัญ;/*ff ie7 ค่านี้ครึ่งสูงกว่า*//
ระยะขอบด้านบน: 0px;
ตำแหน่ง: แก้ไข! สำคัญ;/*ff ie7*/
ตำแหน่ง: Absolute;/*IE6*/
_top: นิพจน์ (evaln (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 {
พื้นหลังสี: #CCC;
ความกว้าง: 100%;
ความสูง: 100%;
ซ้าย: 0;
ด้านบน: 0;/*ff ie7*/
ตัวกรอง: อัลฟ่า (ความทึบ = 50);/*คือ*//
ความทึบ: 0.5;/*ff*/
z-index: 1;
ตำแหน่ง: แก้ไข! สำคัญ;/*ff ie7*/
ตำแหน่ง: Absolute;/*IE6*/
_top: นิพจน์ (evaln (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*/
-
/*จุดจบ*/
</style>
<script type = "text/javascript">
ฟังก์ชั่น showdiv () {
document.getElementById ('popdiv'). style.display = 'block';
document.getElementById ('bg'). style.display = 'block';
-
ฟังก์ชั่นปิด () {
document.getElementById ('popdiv'). style.display = 'none';
document.getElementById ('bg'). style.display = 'none';
-
</script>
</head>
<body>
<div id = "popdiv" style = "จอแสดงผล: ไม่มี;"> ขอแสดงความยินดี! <br/> เกรดของคุณคือ: 60 คะแนน <br/>
<a href = "javascript: clostiv ()"> ปิดหน้าต่าง </a> </div>
<div id = "bg" style = "display: none;"> </div>
<div style = "padding-top: 20px;">
<input type = "subment" name = "" value = "Display Layer" onClick = "JavaScript: showdiv ()" />
</div>
</body>
</html>