Click to See Complete Forum and Search --> : manipulating browser scrollbar position
tsimmons1
11-19-2003, 03:38 PM
I have been looking around to see if it is possible to manipulate browser scrollbar positions with JavaScript. Does anyone know if this is possible? Or what I should look for?
One thing I attempted was to look through some scripts at javascript.com. I didn't find any, but they're arranged alphabetically, and I could have been looking for the wrong thing. I looked for 'scrollbar' and 'browser', but found nothing.
Thanks for any help.
fredmv
11-19-2003, 03:54 PM
Do you mean actually detaching the browser's scrollbar and positioning it somewhere else? If so, I don't believe that can be done.
tsimmons1
11-19-2003, 03:57 PM
No, I just mean making the visible page scroll downward.
fredmv
11-19-2003, 04:10 PM
Sorry for the misunderstanding. You can do that quite easily using methods such as window.scrollTo (http://www.mozilla.org/docs/dom/domref/dom_window_ref109.html) and window.scrollBy (http://www.mozilla.org/docs/dom/domref/dom_window_ref106.html).
tsimmons1
11-19-2003, 04:32 PM
Do those work for IE, too? I've never worked with JavaScript (or any scripting language actually, just full programming languages, primarily Java); can you point me to a beginner's tutorial that will teach me enough to use these methods?
Thanks.
fredmv
11-19-2003, 04:37 PM
Yes, they will work in IE as well. I'm sure you'll have no problem understanding them if you're already familar with a language such as Java. Check the examples provided by the documentation on the Mozilla Gecko DOM reference and MSDN if you want IE-specific stuff.
tsimmons1
11-19-2003, 05:04 PM
Thanks. I'll give this stuff a shot tomorrow.
tsimmons1
11-20-2003, 11:08 AM
Okay, I've got this working, and it was amazingly easy to do. I'm wondering, though, how I can time it differently. It currently executes "onLoad", whereas I'd rather have it execute after the login method of my Java applet runs.
I've been asking some of my Java peers about how I could accomplish this in Java, and it seems to be very intricate. Is there possibly a simpler way to make this happen from the Javascript side?
Thanks.