Connecting Tech Pros Worldwide Help | Site Map

HTML document.body.scrollTop question

 
LinkBack Thread Tools Search this Thread
  #1  
Old February 22nd, 2007, 09:05 PM
=?Utf-8?B?SGFyZHkgV2FuZw==?=
Guest
 
Posts: n/a
Default HTML document.body.scrollTop question

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, 09:05 PM
=?Utf-8?B?SGFyZHkgV2FuZw==?=
Guest
 
Posts: n/a
Default 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 22nd, 2007, 11:45 PM
bruce barker
Guest
 
Posts: n/a
Default 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?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.