472,789 Members | 1,164 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 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 7420
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.