Connecting Tech Pros Worldwide Help | Site Map

HTML document.body.scrollTop question

  #1  
Old February 22nd, 2007, 10:05 PM
=?Utf-8?B?SGFyZHkgV2FuZw==?=
Guest
 
Posts: 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
  #2  
Old February 22nd, 2007, 10:05 PM
=?Utf-8?B?SGFyZHkgV2FuZw==?=
Guest
 
Posts: n/a

re: HTML document.body.scrollTop question


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:
Quote:
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
  #3  
Old February 23rd, 2007, 12:45 AM
bruce barker
Guest
 
Posts: n/a

re: HTML document.body.scrollTop question


use w3c syntax:

document.documentElement.scrollTop


-- bruce (sqlwork.com)

Hardy Wang wrote:
Quote:
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?
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Floating Panel/Div's and Doctype CMM answers 4 March 31st, 2006 03:05 PM
window.opener.location.reload() Darren answers 19 July 23rd, 2005 08:42 PM
click-through to underlying element nutso fasst answers 18 July 23rd, 2005 08:06 PM
Question on Floating Menu Script... Christina Joch answers 4 July 23rd, 2005 05:05 PM