offset얻어와서 다른놈 position 설정하기 !!

pic.jpg
서론 : 근데 그누외 질문도 올려도 괜찮은건가요 ^^?

첨부소스:
<script>
function show(){
pop.style.left=main.offsetLeft+50;
pop.style.top=main.offsetTop;
pop.style.display='block';
}
function hide(){
pop.style.display='none';
}
</script>

<table><tr><td> /// 이 줄(테이블 태그)을 집어 넣으면 안됨 -_-

<table id=main width=100 height=100 border=1 bgcolor=#CCFFFF onmouseover="show()" onmouseout="hide()">
<tr>
<td>
페이지.....<BR>
페이지.....<BR>
페이지.....
</td>
</tr>
</table>

</td></tr></table> /// 역시 이 닫는 태그까지..

<table width=50 height=50 id=pop bgcolor=#FFCCFF style="display:none;position:absolute" border=1>
<tr><td>팝 테이블</td></tr>
</table>


본론:::

주석으로 안된다고 한 테이블로 감싸지 않으면 잘 됩니다..
되는놈 : http://jfam.cafe24.com/t.html

내용인 즉은..

큰 테이블이 있습니다. 1번요..
거기다 마우스를 올리면.. 큰테이블의 위치(offsetLeft,offsetTop)를 가져와서..
작은 테이블의 위치를 결정하고 보여줍니다.. 2번처럼요..
잘 돌아갑니다..

근데~~~!!! 왜 ~~~ ㅜ.ㅡ
id=main 테이블을 상위 테이블로 감싸면 안될까요... 도대체.. 어떻게 계산이 되길래 -_ㅜ
으흐흑.. 도와주십시요~ 상위테이블로 감싸버리면 넣으면 3번처럼 나와버립니다.
이기 왜 안되는겁니깡 ㅜㅜ
안되는 놈 : http://jfam.cafe24.com/f.html


결론: 도와주십시요 ㅜㅜ

첨부파일

pic.jpg (13.4 KB)
0회 2004-07-06 18:19
|

댓글 3개

완두콩님 고마워요!!!!
Parent란놈을 레퍼런스에서 보긴했는데.. 어떻게 쓸지를 몰라서..
좋은 하루되십시요 ^^
---- 참고 ------
---- (설명(?)없음. 알아낸건 너무 어렴풋,게다가 너무 야심-_-;;;) ---------
<script>
function show(){
pop.style.left=getOffsetLeft(main)+50;
pop.style.top=getOffsetTop(main);
pop.style.display='block';
}
function hide(){
pop.style.display='none';
}
function getOffsetLeft (el) {
var ol = el.offsetLeft;
while ((el = el.offsetParent) != null)
ol += el.offsetLeft;
return ol;
}
function getOffsetTop (el) {
var ot = el.offsetTop;
while((el = el.offsetParent) != null)
ot += el.offsetTop;
return ot;
}
</script>
다시 요약하면 -_-
======================================
<BR><BR>
<table><tr><td>
<table id=main border=1>
<tr><td>하하하 테이블 입니다 -_-;;
</td></tr>
</table>
</td></tr></table>

<script>
document.write("T O P:"+main.offsetTop+"<br>");
document.write("LEFT:"+main.offsetLeft);
</script>
====================================== 이놈과
<BR><BR>
<table id=main border=1>
<tr><td>하하하 테이블 입니다 -_-;;
</td></tr>
</table>

<script>
document.write("T O P:"+main.offsetTop+"<br>");
document.write("LEFT:"+main.offsetLeft);
</script>
====================================== 이놈의 값이 다른이유가..;
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누3질답

+
제목 글쓴이 날짜 조회
21년 전 조회 400
21년 전 조회 337
21년 전 조회 314
21년 전 조회 375
21년 전 조회 382
21년 전 조회 334
21년 전 조회 368
우리아빠
21년 전 조회 410
21년 전 조회 464
21년 전 조회 332
21년 전 조회 575
21년 전 조회 345
21년 전 조회 462
21년 전 조회 704
21년 전 조회 415
21년 전 조회 472
21년 전 조회 377
21년 전 조회 616
21년 전 조회 344
21년 전 조회 353
🐛 버그신고