Javascript scroll to top of the page  

Posted by Kishore in

If you are in the bottom of the html page and if you want to go to the top of the page, You can use the following java script.

window.scrollBy(-document.body.clientWidth,-document.body.clientHeight);

Otherwise if you wanna goto top... yes you are right, remove the minuses.

If you want to scroll inside any dom elements, you can use this javascript method to determine the height or width of that element.

document.documentElement.­clientHeight/Width

This entry was posted on Jun 2, 2008 at Monday, June 02, 2008 and is filed under . You can follow any responses to this entry through the comments feed .

0 comments

Post a Comment