tags:

views:

37

answers:

1

Hi,

I am looking to scroll the page to a particular location.Something like this:

function scrollTo(y){
  document.body. some-property = y;
}

I am looking to solve this without using any libraries.

I know scrollTop works in some browsers but I tried it if FF 3.6 and IE 8 and it doesn't work.

Does anyone know how to complete that function ?

+1  A: 

You need window.scrollTo.

function scrollTo(y){
    window.scrollTo(0, y);
}
BalusC