Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need to move back to top of window

    I have a very simple javascript:

    <script language="javascript">
    function moveroom(num)

    {
    document.checkin.room_number.value=num;

    }
    </script>

    Basically the user scrolls through a long list and selects the value which is then put into the textbox. After this is done, I would like the window to focus back to the very top of the page. I have tried top.window.focus() to no avail. I have also tried setting the focus in the textbox, but this does not get all the way back to the top. Any ideas, I'm sure there is a command I just don't know about. Thank you for help.

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There's the "scrollTop" property...
    *this message will self destruct in n-seconds*

  • #3
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the reply

    As far as I know the scrolltop property just gives the value of the how far down the page has scrolled relative to the top of the page. I need something that resets the scrollbar to the top. I can reset the value to zero, but that does not move the bar. Thanks for any help

  • #4
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Codegoboom, I wonder if maybe you meant the "scrollto" property? It worked great.

    <script language="javascript">
    function moveroom(num)

    {
    document.checkin.room_number.value=num;
    scrollTo(0,0);
    }
    </script>

  • #5
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Actually, I meant scrollTop--which is read/write, you know...
    *this message will self destruct in n-seconds*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •