1function getYPosition(){
2 var top = window.pageYOffset || document.documentElement.scrollTop
3 return top;
4}
1document.documentElement.scrollTop = document.body.scrollTop = 1200;
2document.documentElement.scrollLeft = document.body.scrollLeft = 600;Code language: JavaScript (javascript)