<
html
>
<
head
>
<
title
>新文件標題</
title
>
<
script
type="text/javascript">
function Ceng() {
document.getElementById('ceng').style.display = 'block';
document.getElementById('close').style.display = 'block';
return false;
}
function closeCeng() {
document.getElementById('ceng').style.display = 'none';
document.getElementById('close').style.display = 'none';
return false;
}
</
script
>
</
head
>
<
body
>
<
a
href="#" onclick="Ceng()">點擊彈出</
a
>
<
div
id="ceng" style="position:absolute;z-index:2;left:0;top:0;right:0;filter:alpha(opacity=50);margin:1px 1px;display:none;width:100%;height:100%;text-align:center;">
</
div
>
<
div
id="close" style="position:absolute !important;left:30%;top:0px;z-index:3;border:1px solid #ff6600;margin:100px auto;padding:0px;display:none;width:400px;height:300px;text-align:right">
<
a
href="#" onclick="closeCeng()">關閉</
a
>
<
div
style="text-align:center;"><
br
>
<
br
> <
a
href="#">點擊查看 >></
a
></
div
>
</
div
>
</
body
>
</
html
>
該文轉摘出處不詳0.0
****************************有時候遮罩層顯示不出來,莫捉急,請看下面***********************************
當你的頁面中有position:absolute時,咱們的寫的position:absolute可能會失效
<
div
id="ceng" style="position:absolute;z-index:2;left:0;top:0;right:0;filter:alpha(opacity=50);margin:1px 1px;display:none;width:100%;height:100%;text-align:center;">
將position:absolute;換成position: fixed;_position: absolute;可能換出現奇跡!!!
ps:第一次寫,菜鳥剛入手,如有錯誤請pass