<HTML>
<HEAD>
<TITLE>Align Layer</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=euc-kr">
<SCRIPT language="JavaScript">
<!--
function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function DivAlign(theDiv){
var obj,fun,dw,lw,x;
fun = (document.all) ? "document.getElementById" : "MM_findObj";
obj = (document.all) ? document.getElementById(theDiv) : MM_findObj(theDiv);
if(obj){if(document.all){dw = document.body.clientWidth;}
else{dw = innerWidth;}
if(document.layers){lw = obj.clip.width;}
else{lw = obj.style.width.replace("px","");}
x = (document.layers) ? ".left" : ".style.left";
eval(fun+"('"+theDiv+"')"+x+"="+dw+"/2-"+lw+"/2");
}
}
//-->
</SCRIPT>
</HEAD>
<BODY onload="DivAlign('Layer');" onresize="DivAlign('Layer')">
<DIV id="Layer" style="position:absolute; left:0px; top:0px; width:600; height:100%; z-index:10; background-color: yellow;">Align Layer</DIV>
</BODY>
</HTML>


강좌는 나무님(frigga@freechal.com)님께서 제공해주신 자료입니다. 강좌 제공에 대해 깊이 감사드리며 앞으로도 좋은 강좌 부탁드립니다.
Posted by [czar]
,