Can anyone tell me how to turn
<a href="javascript:scroll(0,0)"> Top</a>
aka the Top of Page link into a Bookmarklet.
Not very knowledgeable with JavaScript and cannot get this into want I want it to be.
Or if I am using the wrong code, then can you fix it for me and turn it into the bookmarklet.
Can anyone tell me how to turn
<a href="javascript:scroll(0,0)"> Top</a>
aka the Top of Page link into a Bookmarklet.
Not very knowledgeable with JavaScript and cannot get this into want I want it to be.
Or if I am using the wrong code, then can you fix it for me and turn it into the bookmarklet.
Share Improve this question edited Jun 1, 2009 at 16:14 GEOCHET 21.3k15 gold badges77 silver badges99 bronze badges asked May 27, 2009 at 13:22 ethanethan3 Answers
Reset to default 8Create a bookmark with location:
javascript:void(function(){window.scroll(0,0)}())
Works in Firefox 3 and IE 7.
Another option ...
function scrollUp(){
var offy;
if(self.pageYOffset) {
offy = self.pageYOffset;
} else if(document.documentElement && document.documentElement.scrollTop){
offy = document.documentElement.scrollTop;
} else {
offy = document.body.scrollTop;
}
if(offy <= 0) return;
window.scrollBy(0, -50);
setTimeout("scrollUp()", 10);
}
<a href="javascript: scrollUp();">Start Scroller!</a>
here is an article from my bookmarks .. its a simple and easy solution that I have been using for a long time now.
http://www.geeksww./tutorials/web_development/javascript/tips_and_tricks/javascript_go_to_top_of_page.php
hope this works