1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

'Top of Page' Code?

Discussion in 'HTML & Website Design' started by master-yoda, Jan 3, 2010.

  1. #1
    Can anyone tell me the code so I can add 'Top of Page' at the bottom of my pages, thak you.
     
    master-yoda, Jan 3, 2010 IP
  2. K_E_M_O

    K_E_M_O Peon

    Messages:
    49
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use this:
    <a href="#" style="float:right; onclick="new Effect.ScrollTo('yukari'); return false;">TOP</a>
    Code (markup):
     
    K_E_M_O, Jan 3, 2010 IP
  3. Dogs_and_things

    Dogs_and_things Active Member

    Messages:
    97
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #3
    <a href="" onclick="window.scrollTo(0,0); return false;">Back to top</a>
    HTML:
     
    Dogs_and_things, Jan 3, 2010 IP
  4. master-yoda

    master-yoda Well-Known Member

    Messages:
    1,246
    Likes Received:
    15
    Best Answers:
    1
    Trophy Points:
    138
    #4
    I have tried this code but it dosnt work.
     
    master-yoda, Jan 3, 2010 IP
  5. Dogs_and_things

    Dogs_and_things Active Member

    Messages:
    97
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #5
    Try the code I posted.
     
    Dogs_and_things, Jan 3, 2010 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #6
    <body id="top">
    ...
    <a href="#top">top</a>
    Code (markup):
    cheers,

    gary
     
    kk5st, Jan 3, 2010 IP
  7. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #7
    Gary has it 'kind of' right, though really I'd not put the id on the body element and instead target some other id at the top of the code since usually there's SOME wrapper you could hit.

    But Christ, what's up with the javascript for nothing bullshit? Javascript for that is NOT the answer. Well, at least we had no shmucks presenting some asshat jquery script as an answer.... YET.
     
    deathshadow, Jan 3, 2010 IP
    googsmaster likes this.
  8. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #8
    Yeah, but I knew <body> was at the top. I couldn't know what other element might work. ;)

    That's the gods' truth.

    cheers,

    gary
     
    kk5st, Jan 3, 2010 IP
    googsmaster likes this.
  9. Dogs_and_things

    Dogs_and_things Active Member

    Messages:
    97
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #9
    Oh comm on, you schmuck,:) what's wrong with a tiny bit of javascript?

    It works, doesn´t it.:p
     
    Dogs_and_things, Jan 4, 2010 IP
  10. googsmaster

    googsmaster Guest

    Messages:
    594
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Dont try the JS code, just try the simple HTML self code given by "kk5st" It will work.
     
    googsmaster, Jan 4, 2010 IP
  11. nunuaza

    nunuaza Peon

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    thank you, it works for me
     
    nunuaza, Jan 4, 2010 IP
  12. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #12
    Because it's more code than needed, doesn't work on most handhelds, and provides no graceful degradation for the people who tell you where to shove .js.

    Using onclick for something HTML ALREADY DOES is just stupid. It ranks right up there with the mm_ javascript from adobe or methods like prototype on the "really **** stupid" javascript for nothing scale.
     
    deathshadow, Jan 4, 2010 IP
  13. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #13
    I would really, really reconsider that solution. It is a terribly poor practice.

    cheers,

    gary
     
    kk5st, Jan 4, 2010 IP
  14. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #14
    From the response after yours by Prdomain one can assume nobody is listening to the good advice, and just want to sleaze it out any old way... *SIGH*.

    In other words business as usual.
     
    deathshadow, Jan 4, 2010 IP
  15. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Poor dogs n things : ) Well, at least you can switch to HTML on your pages now : ) I block scripts myself. They make me feel dirty.

    You could almost just do <a href="#">back to top</a> except there were some browsers who didn't by default go back to the top of the page... but a lot of them do.
     
    Stomme poes, Jan 4, 2010 IP
  16. Dogs_and_things

    Dogs_and_things Active Member

    Messages:
    97
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #16
    You're right Poes,

    Looks like mr. Smuck is right, for a change.

    When I have some time I'll remove that horrible piece of unnecessary crap from my site and replace it with decent html. :)
     
    Dogs_and_things, Jan 4, 2010 IP