document.body.scrollTop에 대해서 질문 올립니다.
그동안 Table로 레이아웃짜고 dtd형식도 지정안하고 할때는 문제없이 작동하던 document.body.scrollTop이 dtd 형식 지정하고 사용하니 작동을 안하네요;;;
아무리 스크롤을 해도 document.body.scrollTop이 0을 반환합니다. 아울러 다른 브라우져에서 사용하려고 하던 window.pageYOffset 값도 아무리 스크롤 해도 0을 반환하구요ㅠㅠ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
지금 제가 코딩하고 있는 문서의 형식입니다. document.body.scrollTop과 window.pageYOffset을 사용할 수 있는 방법이 없을까요?<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>
아무리 스크롤을 해도 document.body.scrollTop이 0을 반환합니다. 아울러 다른 브라우져에서 사용하려고 하던 window.pageYOffset 값도 아무리 스크롤 해도 0을 반환하구요ㅠㅠ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
지금 제가 코딩하고 있는 문서의 형식입니다. document.body.scrollTop과 window.pageYOffset을 사용할 수 있는 방법이 없을까요?<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>
댓글 1개
sjsjin
14년 전
// 자바스크립트펑션을 하나 등록.(ie 검증)
function ietruebody()
{
if(document.documentElement && document.documentElement.scrollTop) // ie6 Strict
return document.documentElement;
else if(document.documentElement && document.documentElement.clientHeight) // ie6 Strict
return document.documentElement;
else if (document.body) // ie < ie 6
return document.body;
}
// IE 버젼구분없이 document.body.scrollTop 대체함수로 변경
evt = (e || window.event); // IE 냐 그외브라우저냐.
mouse_extX = (evt.pageX || evt.x + ietruebody().scrollLeft);
mouse_extY = (evt.pageY || evt.y + ietruebody().scrollTop);
// window.pageYOffset 은 아래 함수로사용
offsetTop
function ietruebody()
{
if(document.documentElement && document.documentElement.scrollTop) // ie6 Strict
return document.documentElement;
else if(document.documentElement && document.documentElement.clientHeight) // ie6 Strict
return document.documentElement;
else if (document.body) // ie < ie 6
return document.body;
}
// IE 버젼구분없이 document.body.scrollTop 대체함수로 변경
evt = (e || window.event); // IE 냐 그외브라우저냐.
mouse_extX = (evt.pageX || evt.x + ietruebody().scrollLeft);
mouse_extY = (evt.pageY || evt.y + ietruebody().scrollTop);
// window.pageYOffset 은 아래 함수로사용
offsetTop
게시글 목록
| 번호 | 제목 |
|---|---|
| 12245 |
PHP
php 함수검색기 입니다.
|
| 12244 | |
| 12243 | |
| 12241 | |
| 12239 | |
| 12238 | |
| 12237 |
Mobile
모바일웹에서 현재위치의 좌표 가져오기
|
| 12233 |
JavaScript
alert 창 디자인하기
3
|
| 12232 |
JavaScript
자동완성 자바스크립트
|
| 12230 |
PHP
주소로 구글 좌표 구하기
1
|
| 355 | |
| 12227 | |
| 12226 | |
| 12225 | |
| 353 | |
| 12221 |
PHP
vi 정리 입니다.
3
|
| 12220 | |
| 12219 | |
| 12218 |
PHP
검색사이트 긁어오기 입니다.
|
| 12217 | |
| 12216 | |
| 12215 | |
| 12214 | |
| 12213 | |
| 12212 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기