JavaScript 팝업 레이어 효과
저자:Eve Cole
업데이트 시간:2009-06-11 16:22:38
함수 sAlert(str){
var msgw,msgh,bordercolor;
msgw=400; //프롬프트 창의 너비
msgh=100;//프롬프트 창의 높이
titleheight=25 //프롬프트 창 제목 높이
bordercolor="#336699";//프롬프트 창의 테두리 색상
titlecolor="#99CCFF";//프롬프트 창 제목 색상
var 폭,s높이;
sWidth=document.body.offsetWidth;
높이=화면.높이;
var bgObj=document.createElement("div");
bgObj.setAttribute('id','bgDiv');
bgObj.style.position="절대";
bgObj.style.top="0";
bgObj.style.Background="#777";
bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
bgObj.style.opacity="0.6";
bgObj.style.left="0";
bgObj.style.width=sWidth + "px";
bgObj.style.height=sHeight + "px";
bgObj.style.zIndex = "10000";
document.body.appendChild(bgObj);
var msgObj=document.createElement("div")
msgObj.setAttribute("id","msgDiv");
msgObj.setAttribute("align","center");
msgObj.style.Background="흰색";
msgObj.style.border="1px 단색 " + 테두리색상;
msgObj.style.position = "절대";
msgObj.style.left = "50%";
msgObj.style.top = "50%";
msgObj.style.font="12px/1.6em 베르다나, 제네바, Arial, Helvetica, 산세리프";
msgObj.style.marginLeft = "-225px" ;
msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
msgObj.style.width = msgw + "px";
msgObj.style.height =msgh + "px";
msgObj.style.textAlign = "중심";
msgObj.style.lineHeight="25px";
msgObj.style.zIndex = "10001";
var title=document.createElement("h4");
title.setAttribute("id","msgTitle");
title.setAttribute("align","right");
title.style.margin="0";
title.style.padding="3px";
title.style.Background=테두리색상;
title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, 끝x=100, 끝Y=100,style=1,opacity=75,finishOpacity=100);";
title.style.opacity="0.75";
title.style.border="1px 단색 " + bordercolor;
title.style.height="18px";
title.style.font="12px 베르다나, 제네바, Arial, Helvetica, 산세리프";
title.style.color="흰색";
title.style.cursor="포인터";
title.innerHTML="닫기";
title.onclick=함수(){
document.body.removeChild(bgObj);
document.getElementById("msgDiv").removeChild(제목);
document.body.removeChild(msgObj);
}
document.body.appendChild(msgObj);
document.getElementById("msgDiv").appendChild(제목);
var txt=document.createElement("p");
txt.style.margin="1em 0"
txt.setAttribute("id","msgTxt");
txt.innerHTML=str;
document.getElementById("msgDiv").appendChild(txt);
}