<table border=0 id=seol>
<tr>
<td>
zzzz
</td>
</tr>
</table>
<script>
var el = document.all.seol;
var rect = el.getBoundingClientRect();
/*
var s = "";
s+="body로부터 left : " + (rect.left-2) + "<br>";
s+="body로부터 top : " + (rect.top-2) + "<br>";
s+="table로부터 left : " + el.offsetLeft + "<br>";
s+="table로부터 top : " + el.offsetTop + "<br>";
*/
intLeft = (rect.left-2);
intTop = (rect.top-2);
alert(intLeft+'|'+intTop);
document.all.Layer2.style.left = intLeft;
document.all.Layer2.style.top = intTop;
</script>
'프로그래밍 > Javascript' 카테고리의 다른 글
onfocus=this.blur(); 한번에 처리하기 (0) | 2011.06.17 |
---|---|
VBscript의 replace함수와 같은 javascript는 없나요? (0) | 2011.06.17 |
이미지 사이즈 줄이기(600이상만) (0) | 2011.06.17 |
스크린의 넓이 구하기 (0) | 2011.06.17 |