View Full Version : Resolved Scroll Position, Start and Restart

07-28-2009, 10:31 PM
Hi everyone,

I'm using an autoscroll feature on my webpage using javascript

and also implementing a reset button to bring the scroll to the very top

but the two are not being compatible.. the reset button DOES scroll to the top but when I click the start button again after its been reset it starts scrolling from where it last left off (and not back from the top).

Here's the code:

function back_to_top(id){
i = 0

function scroll() {
i = i + speed

and the buttons:

<input onclick="scroll()" type="button" value="Start">
<input onclick="clearTimeout(t1)" type="button" value="Stop">
<br><input onclick="back_to_top('transcript')" type="button" value="Reset">

This is my final task for this site and this "glitch" is starting to get very frustrating. Any help would be greatly appreciated!

07-28-2009, 10:34 PM
change your back_to_top function from thisL

function back_to_top(id){

to this

function back_to_top(id){

And may I suggest that it is better to end your lines and/or commands with ";" (semi-columns)

07-28-2009, 10:41 PM
wow, I can't believe how helpful (and fast!) you guys have been here.

big thanks ckeyrouz, it worked perfectly.