I have a div
on my page which I want to scroll up to after clicking a link in my navigation bar.
I wrote the following JavaScript for that, but it is not working.
<script>
var currentpos = 0;
function movedown(element){
window.scrollBy(0,element.offsetHeight);
delay = window.setInterval('movedown();',100);
currentpos+=1;
if(currentpos == element.offsetheight){
stopscroll();
}
}
function stopscroll(){
window.clearInterval(delay);
}
</script>