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 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    84
    Thanks
    5
    Thanked 0 Times in 0 Posts

    make a button put page to top?

    Hello,

    I want a button on my site that says "top of page", and it moves the user to the top of the page they are on?

    I'm not sure what to search on google so i dont no how to do it.

    Please could someone show me?

    Thanks

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello sphinx1994,
    Your wanting an anchor tag. Have a look here - http://www.scribblegraphics.com/arti...s-anchors.html or google for more examples.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    New Coder
    Join Date
    Jan 2009
    Posts
    84
    Thanks
    5
    Thanked 0 Times in 0 Posts
    i used this,( i put on the top of my page):

    Code:
    <a name="#top"></a>
    and this link @ the bottom of the page:

    Code:
    <a href="#top">Top of page</a>
    when i click the link it still doesnt put me to the top of the page,,
    what have i done wrong?
    thanks

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    You should not use name attributes for creating such anchors, which is deprecated. use id attribute instead. In that way you can set anchor to any element, and don't actually need to create an extra empty anchor. Say
    Code:
    <h1 id="header">Site Heading</h1>
    
    
    
    
    .........
    <a href="#header">Go to top</a>
    Refer http://www.w3.org/TR/REC-html40/stru....html#h-12.2.3
    Last edited by abduraooft; 05-04-2009 at 12:00 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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