a javascript question

Discussion in 'JavaScript' started by SimonCuts, Dec 11, 2006.

  1. #1
    Hi,

    I'm a new to javascript.
    I have a javascript function,
    and I want to instruct it to go to the top of the page,
    like in HTML #top .
    What is the way to perform it?

    Thanks in advance.
     
    SimonCuts, Dec 11, 2006 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    You can use: window.scroll(0,0)
    Causes the window to scroll to the specified x- and y-offset at the upper-left corner of the window. Syntax: window.scroll(x,y)
     
    ajsa52, Dec 11, 2006 IP
  3. SimonCuts

    SimonCuts Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you ajsa52,

    The instruction performed exactly.
     
    SimonCuts, Dec 11, 2006 IP