*{margin:0;padding:0px;}
body{padding:30px;}
#show{width:886px;height:492px;display:none;padding:1px;position:absolute;border:1px solid #4c77aa;background:#f2f7fd;z-index:11;zoom:1;
background-p_w_picpath:url(%E5%BE%AE%E4%BF%A1%E5%95%86%E5%9F%8E%E7%BA%A2%E5%8C%85-02.jpg);}
#show h3{ color:#fff;font-size:14px;padding:5px;}
#show span{position:absolute;right:3px;top:3px;display:block;cursor:pointer;color:#000;font-weight:bold;}
#show p{padding:5px; }
#text{font-size:12px;text-indent:2em;line-height:20px; }
#bgbox{position:absolute;left:0;top:0;background:#000;filter:alpha(opacity=30);opacity:0.3;z-index:10}
function show(){
var iWidth = document.documentElement.clientWidth;
var iHeight = document.documentElement.clientHeight;
var bgObj = document.createElement("div");
bgObj.setAttribute("id","bgbox");
bgObj.style.width = iWidth+"px";
bgObj.style.height =Math.max(document.body.clientHeight, iHeight)+"px";
document.body.appendChild(bgObj);
var oShow = document.getElementById('show');
oShow.style.display = 'block';
oShow.style.left = (iWidth-888)/2+"px";
oShow.style.top = (iHeight-494)/2+"px";
function oClose(){
oShow.style.display = 'none';
document.body.removeChild(bgObj);
}
var oClosebtn = document.createElement("span");
oClosebtn.innerHTML = "×";
oShow.appendChild(oClosebtn);
oClosebtn.onclick = oClose;
bgObj.onclick = oClose;
}
弹出层标题栏
这里是弹出层内容,内容可以是文字、图片等,可以是iframe传进来,也可以用jQuery的load()传进来。如有什么不合理的或可以改进的,大家可以给我留言,共同学习。