그동안 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개
// 자바스크립트펑션을 하나 등록.(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
게시글 목록
| 번호 | 제목 |
|---|---|
| 315 | |
| 311 | |
| 12040 | |
| 20370 | |
| 20365 |
CSS
css가 충돌이 됬을때
4
|
| 12039 |
JavaScript
풀스크린 스크립트
|
| 20364 | |
| 12037 |
웹서버
vi 온라인 학습장
1
|
| 12035 |
jQuery
강력한 무료 멀티 업로더...
1
|
| 12032 | |
| 12031 | |
| 20362 |
HTML
HTML5 자바스크립트 API
1
|
| 12024 |
기타
P3P 규약의 이해
6
|
| 12022 | |
| 303 | |
| 12020 | |
| 12015 | |
| 12010 |
PHP
외부이미지 썸네일 만들기
4
|
| 12009 |
웹서버
퍼미션 계산기-아주 좋습니다.
|
| 12007 |
JavaScript
화면전체에 눈 내리는 효과
1
|
| 12005 |
PHP
외부이미지 서버에 저장하기
1
|
| 12004 |
PHP
유튜브 api 사용하기
|
| 20361 | |
| 12002 | |
| 11997 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기