마스크 레이어가 있는 프롬프트 상자 만들기
2340 단어 커버 레이어
function showmsg(t_errmess){
var sl = document.body.scrollLeft;
var sh = document.body.scrollTop;
var ow = document.body.offsetWidth;
var oh = document.body.offsetHeight;
try{
//alert("sl:"+sl+",sh:"+sh+",ow:"+ow+",oh:"+oh);
var errDiv=document.getElementById("lay_err123");
if(errDiv==null || typeof(errDiv)=="undefined"){
errDiv = document.createElement("div");
errDiv.id="lay_err123";
if(ow>350){
errDiv.style.width="300px";
errDiv.style.left= (sl+ow/2-100)+"px";
}else{
errDiv.style.width="80%";
errDiv.style.left="8%";
}
errDiv.style.position = "absolute";
errDiv.style.top=(sh+oh/4)+"px";
errDiv.style.backgroundColor="#99ccff";
errDiv.style.border="2px solid #3399ff";
errDiv.style.zIndex=200;
errDiv.style.textAlign="left";
document.body.appendChild(errDiv);
}
var lay1 = document.getElementById("lay1_error");
if(lay1==null || typeof(lay1)=="undefined"){
lay1 = document.createElement("iframe");
lay1.id="lay1_error";
lay1.style.width = ow+"px";
lay1.style.height = oh+"px";
lay1.style.position = "absolute";
lay1.style.left = sl+"px";
lay1.style.top = sh+"px";
lay1.style.backgroundColor="#99ccff";
lay1.style.zIndex=1;
lay1.style.filter = "alpha(opacity=50)";
document.body.appendChild(lay1);
}
var str="<div style=\"float:right;clear:both;cursor:hand;color:red;width:30px;\" "
+"onclick=\"document.getElementById('lay_err123').style.display='none';document.getElementById('lay1_error').style.display='none';\">[ ]</div><br>";
errDiv.innerHTML=str+t_errmess;
errDiv.style.display="";
lay1.style.display="";
}catch(e){
//alert(e.description);
}
}