How do I change this script ?

Discussion in 'JavaScript' started by Lemon116, Jul 6, 2007.

  1. #1
    This script scrolls the window all the way to the bottom of the page, then starts all over again.

    I want to change this script so it will do the following function only ones and from Down-Top, so if a visitor wants to scroll down a page - he cant, the page gets up again.

    Is it possible to do with a change in the following script ?

    Giving away Rep. :D



    <script language="JavaScript1.2">

    var speed=1
    var currentpos=0,alt=1,curpos1=0,curpos2=-1
    function initialize(){
    startit()
    }

    function iecompattest(){
    return (document.compatMode!="BackCompat")? document.documentElement : document.body
    }

    function scrollwindow(){
    if (document.all)
    temp=iecompattest().scrollTop
    else
    temp=window.pageYOffset
    if (alt==0)
    alt=1
    else
    alt=0
    if (alt==0)
    curpos1=temp
    else
    curpos2=temp
    if (curpos1!=curpos2){
    if (document.all)
    currentpos=iecompattest().scrollTop+speed
    else
    currentpos=window.pageYOffset+speed
    window.scroll(0,currentpos)
    }
    else{
    currentpos=0
    window.scroll(0,currentpos)
    }
    }
    function startit(){
    setInterval("scrollwindow()",10)
    }
    window.onload=initialize
    </script>
     
    Lemon116, Jul 6, 2007 IP
  2. Cloudberries

    Cloudberries Peon

    Messages:
    74
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Just to clarify - you're wanting a script that will..

    1) Initially, start the page at the bottom
    2) Automatically scroll the page up until it reaches the top
    3) Prevent the user from scrolling the page down again?
     
    Cloudberries, Jul 6, 2007 IP
  3. Lemon116

    Lemon116 Active Member

    Messages:
    1,245
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    90
    #3
    yes - something like it :)
     
    Lemon116, Jul 7, 2007 IP