473,545 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

scrollbar

is there a method to get scrollbar position?
Jul 20 '05 #1
6 6887
Cool Mentalist wrote:
is there a method to get scrollbar position?


window.pageXOff set
window.pageYOff set
PointedEars
Jul 20 '05 #2
"Thomas 'PointedEars' Lahn" wrote on 12/11/2003:
Cool Mentalist wrote:
is there a method to get scrollbar position?


window.pageXOff set
window.pageYOff set


Is the IE implementation of those properies broken or missing? I get
'undefined' with both. The same holds true with the x and y
properties of Link and Anchor objects. However, the x and y
properties of the event object have values.

Mike

--
Michael Winter
M.Winter@[no-spam]blueyonder.co.u k (remove [no-spam] to reply)
Jul 20 '05 #3
"Michael Winter" <M.Winter@[no-spam]blueyonder.co.u k> wrote in message
news:g5******** *************@n ews-text.cableinet. net...
"Thomas 'PointedEars' Lahn" wrote on 12/11/2003:
Cool Mentalist wrote:
is there a method to get scrollbar position?


window.pageXOff set
window.pageYOff set


Is the IE implementation of those properies broken or missing?

<snip>

IE does not implement them at all. They are the preferred values to read
but if absent (so in IE) the scrollTop and scrollLeft values can be read
from the root element. Exactly which element is the root element depends
on the browser/version _and_ (if it exists) the "compatMode ".

In the absence of pageXOffset/YOffset value I would test to see if
document.compat Mode is defined, if it is not then the root element is
document.body. If it is defined and holds the string value "CSS1Compat "
then the root element is document.docume ntElement (the HTML element) and
the scroll values should be read from there. Any other values of
document.compat Mode ("BackCompat ", "QuirksMode ", etc) mean that
document.body is still the root element and it should be read for the
required values.

Richard.
Jul 20 '05 #4
I used document.body.s crollTop and it worked a treat. I take it i should put in
pageXOffset for other browsers tho.

Nick
Jul 20 '05 #5
Cool Mentalist wrote:
I used document.body.s crollTop and it worked a treat.
I take it i should put in pageXOffset for other browsers tho.


Yes, you should:

if (typeof pageXOffset != "undefined" )
{
... pageXOffset ...
}
else if (/* test suggested by Richard */)
{
... referenceToRoot Element.scrollT op ...
}
HTH

PointedEars
Jul 20 '05 #6
Cool Mentalist wrote:
I used document.body.s crollTop and it worked a treat.
I take it i should put in pageXOffset for other browsers tho.


Yes, you should:

if (typeof pageYOffset != "undefined" )
{
... pageYOffset ...
}
else if (/* test suggested by Richard */)
{
... referenceToRoot Element.scrollT op ...
}
The same goes for `pageXOffset' and `scrollLeft'.
HTH

PointedEars
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
26021
by: Sujan | last post by:
Hello all, Is it possible to remove scrollbar(s) without using frames. Is there any code which could be applied in body tag to remove scrollbar(s). Thanks in adv, Sujan
4
4394
by: Price Brattin | last post by:
I dragged a datagrid onto a VB.Net WinForm and used the properties page and a few lines of code to set it up, including the DataSource. No wizard setup was used. It works fine except for one thing: there is no vertical scrollbar even there are more lines than can be shown on the datagrid. There is plenty room on the right for the scrollbar...
9
4312
by: kjs | last post by:
Is there any was to control the color of the scrollbars when using the 'overflow: scroll' attribute? TIA, Karl
0
1018
by: h-h | last post by:
BODY { scrollbar-face-color: #f5f5f5; scrollbar-highlight-color: #666666; scrollbar-shadow-color: #666666; scrollbar-3dlight-color: #ffffff; scrollbar-arrow-color: #666666; scrollbar-track-color: #ffffff; scrollbar-darkshadow-color: #ffffff; background-color:white;
1
1474
by: Shun | last post by:
Hello, How to the add a blue color scrollbar to the browser Left and bottom. Thanx Shun
0
2601
by: d.steininger | last post by:
Hi there! Is there a way to bind a Textbox.Text to a ScrollBar.Value (not the Textbox-own Scrollbar) and vice versa? The Problem: I have to deal with two controls. The Textbox should accept integers as input, limited by a ScrollBar's Minimum- and Maximum. Changing the ScrollBar-Value should update the Textbox-Text and vice versa. So the...
14
3932
by: Michael Weis | last post by:
Hello all, as a non-professional in these things, I searched for this topic but found no satisfying answer: I have to create a site with 3 frames. (Please no diskussion about the sense of using frames...) The main frame has to show a vertical scrollbar if content is bigger than one display page. This works well, but:
2
10642
by: kurt sune | last post by:
How do I render the scrollbars by CSS in a listbox? I have understood that an asp listbox gets rendered as a select element. So I tried first by adding a style element: ..TA {scrollbar-3dlight-color:aqua; scrollbar-arrow-color:fuchsia; scrollbar-base-color:fuchsia;
3
3187
by: nicky77 | last post by:
Hi, before you say it i know frames are bad practice - but i'm developing dynamic content on a site which has already been designed, so alas there's no option but to use them. Anyway, I just want to add simple styling to the scrollbar of the left hand frame of the page, but the styling i've applied isn't working for some reason. The site is at...
1
13718
by: Tom | last post by:
First, I posted a similar request for help in another group and now don't find the posting. Problem with my newsreader perhaps ... but apologies if this appears as a cross posting. My code is inconsistent in the detection of a vertical scrollbar. This involves situations when less than the client area is needed to hold the small amount of...
0
7415
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7928
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7440
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5997
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4963
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3470
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3451
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
726
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.