473,387 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem programatically setting scrollbar position in IE

Hello,

I have a problem setting the scrollbar position of a div region on a
webpage which is posted at

http://www.geocities.com/virtuosity999/Logon.htm

If the page is loaded with Netscape, the vertical scrollbar on the left
side will be moved down a little bit but if the page is loaded with
Internet explorer, the scrollbar remains at the top of the scroll area.
The tag for the div region is:

<div id="UserList" style="border: 0px none rgb(0, 0, 0); position:
static; width: 100%; height: 180px; overflow: auto; background-color:
rgb(231, 232, 234); visibility: visible;">

The javascript I'm using to move the scrollbar down is:

document.getElementById('UserList').scrollTop=25

Can anyone tell me why the javascript code above works in Netscape but
not in Internet Explorer? Is there any way to fix the code so that it
will work in Internet Explorer and Netscape?

Thank you for your help.

Jul 23 '05 #1
1 7461
alvinp...@gmail.com wrote:
Hello,

I have a problem setting the scrollbar position of a div region on a
webpage which is posted at

http://www.geocities.com/virtuosity999/Logon.htm

If the page is loaded with Netscape, the vertical scrollbar on the left side will be moved down a little bit but if the page is loaded with
Internet explorer, the scrollbar remains at the top of the scroll area.

The tag for the div region is:

<div id="UserList" style="border: 0px none rgb(0, 0, 0); position:
static; width: 100%; height: 180px; overflow: auto; background-color:
rgb(231, 232, 234); visibility: visible;">

The javascript I'm using to move the scrollbar down is:

document.getElementById('UserList').scrollTop=25

Can anyone tell me why the javascript code above works in Netscape but not in Internet Explorer? Is there any way to fix the code so that it will work in Internet Explorer and Netscape?

Thank you for your help.


Try calling it onload. IE often needs to 'set up' before it allows
scripting of elements.

Unfortunately, you'll probably notice a annoying delay before
window.onload is called - the result of a fairly horrendous amount of
code duplication. Even the example you posted above might have simply
been:

<div id="UserList"
style="border:none;height:180px;overflow:auto;back ground-color:rgb(231,
232, 234);">

....and should have been moved to a stylesheet, possibly assigned by
class to avoid duplication. Many, many more examples. Even your naming
is verbose. Slim that thing down. #;-)

Jul 23 '05 #2

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

Similar topics

4
by: Paul T. RONG | last post by:
Dear all, Can one control the subform scrollbar through vba? For example, I would like to make two command buttons on the main form to control the subform scrollbar. Click 1st button the...
1
by: Tamir Kamara | last post by:
Hi, I have a page with several server controls (textboxes, datagrid, ...) which are positioned absolutely from the right of the page (like RIGHT: 25px; POSITION: absolute;). that works well if...
6
by: Colin McGuire | last post by:
Hello experts, this is a repost but I have been (much) more clear. I want to know the position of the horizontal scrollbar in a textbox as a percentage - if the horizontal scrollbar is hard...
5
by: Frank Rizzo | last post by:
I reload the items in the listview on a regular schedule (i.e. clear the listview, then load it up with fresh values). I want add a convinience to the user whereby my application remembers the...
9
by: Andy Baxter | last post by:
hello, I'm writing a panoramic image viewer in html / javascript. The idea is I have a div with two identical panoramic photographs embedded in it. The clipping on the div is set to make it a...
1
by: orofiamma | last post by:
It may appear odd, but I need to control the vertical scrollbar position of a listbox by buttons. So I'll have a "Scroll up" button and a "Scroll down" button. When I click "Scroll down", i.e.,...
4
by: Blackbrand | last post by:
I'll start off with what i'm trying to do: i want to search my data programmatically and then jump to the row in the datagrid. My data will almost allways go out of the datagrids bounds so if the...
0
by: =?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?= | last post by:
Hi, I have the following problem in VB, but I think some C++ freaks have more in deep understanding: I have an OCX which contains an picture box which works as a container for controls. I...
5
by: Michael7 | last post by:
Hi everyone, I thought I had it all fixed, but today I noticed IE mistreating my page that I was setting up to use CSS. Here's the page: http://workmenforchrist.org/ The CSS affecting that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.