62,050
社区成员
发帖
与我相关
我的任务
分享
//创建一个遮罩层
function Layer(htmlContent)
{
//创建一个遮罩层,半透明
//------------------我是谁?我是割线!-----------------//
var lay = document.createElement("div");
lay.id = "frame"
with(lay.style)
{
width = "100%";
height = String(Math.max(document.documentElement.clientHeight,document.documentElement.scrollHeight))+"px";
background = "#000000";
position = "absolute";
left = "0";
top = "0";
filter = 'Alpha(opacity=50)';
opacity = '0.5';
}
document.body.appendChild(lay);
//创建显示内容
var info = document.createElement("div");
info.id = "msg";
info.innerHTML = htmlContent;
$("frame").appendChild(info);
with(info.style)
{
position = "absolute";
left = "0px";
top = document.documentElement.scrollTop + "px";
marginLeft = (document.documentElement.clientWidth - info.offsetWidth)/2 + "px";
marginTop = (document.documentElement.clientHeight - info.offsetHeight)/2 + "px";
}
document.body.appendChild(info);
//hiddenSelect("hidden"); //隐藏下拉菜单
}
//关闭遮罩层
function hiddenDiv(){document.body.removeChild($("frame"));document.body.removeChild($("msg"));}
//返回ID值
function $(id){return document.getElementById(id);}