By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

HTML document.body.scrollTop question

P: n/a
Hi all,
I created a complex ASPX page, nested inside a master page and Ajax
UpdatePanel. In one of my Javascript function I need to capture mouse
position. I use alert(document.body.scrollTop) to test scroll bar position.
Even though I have a long scroll bar and already to end of the page, when I
call this function, I always get "0" as document.body.scrollTop.

Meanwhile I created a very simple HTML page with a lot of <brto test, it
works fine. I tried both IE6 and IE7, no luck at all.

My question is under what situation document.body.scrollTop always returns 0
in IE?
--
Regards
Hardy
Feb 22 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
After some tries, if I remove

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Then it works fine! Any idea how can I make it work with XHTML 1.0?
--
Regards
Hardy
"Hardy Wang" wrote:
Hi all,
I created a complex ASPX page, nested inside a master page and Ajax
UpdatePanel. In one of my Javascript function I need to capture mouse
position. I use alert(document.body.scrollTop) to test scroll bar position.
Even though I have a long scroll bar and already to end of the page, when I
call this function, I always get "0" as document.body.scrollTop.

Meanwhile I created a very simple HTML page with a lot of <brto test, it
works fine. I tried both IE6 and IE7, no luck at all.

My question is under what situation document.body.scrollTop always returns 0
in IE?
--
Regards
Hardy
Feb 22 '07 #2

P: n/a
use w3c syntax:

document.documentElement.scrollTop
-- bruce (sqlwork.com)

Hardy Wang wrote:
After some tries, if I remove

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Then it works fine! Any idea how can I make it work with XHTML 1.0?
Feb 23 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.