중앙정렬 사이트에서 좌/우측에 배너를 위치시킬때 사용한다.

FireFox에서는 픽셀값을 숫자형으로 형변환해서 적용해야 실행된다는 점을 유념하자.





<html>
<body onresize="javascript:centerWindow();" onload="centerWindow();">
<script language="JavaScript">
<!--
function centerWindow() {
var xMax = document.body.clientWidth, yMax = document.body.clientHeight;

var xOffset = (xMax-200)/2+20, yOffset = (yMax-150)/2+40; 
//중심에서 오른쪽으로 20, 아래로 40픽셀에 항상 위치하는 레이어
var divMenu = document.getElementById('Layer1').style;
divMenu.top = parseInt(yOffset) + 'px';
divMenu.left = parseInt(xOffset) + 'px';
}
//centerWindow(); 
//-->
</script>

<div id="Layer1" style="position:absolute; left:200px; top:80px; width:200px; height:150px; z-index:1"> 
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" bgcolor=#FFFFFF style="border:#808080 1px solid;" height=150>
<span style="font-family:굴림; font-size:9pt">
항상 중심에 뜨는 <br>
레이어 샘플입니다.</span><br>
<img src="http://www.google.co.kr/images/logo_sm.gif" width="150" height="55" alt="배너"> 
</td>
</tr>
</table>
</div>
</body>
</html> 

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2009/07/03 16:41 2009/07/03 16:41
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/4422

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/4422

« Previous : 1 : ... 2019 : 2020 : 2021 : 2022 : 2023 : 2024 : 2025 : 2026 : 2027 : ... 6391 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/05   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Statistics Graph

Site Stats

Total hits:
197480
Today:
368
Yesterday:
857