I see you've solved your first problem onload which is what I would have suggested. The second problem looks to me to be that because your 'contentarea' can be scrolled at the given moment that different content is loaded into it and because that new content can be taller than the visible part of the container, that the scroll state of the container is being preserved whenever possible. Here is what you need to execute to reset it to the top:
Code:
document.getElementById('contentarea').scrollTop=0
You can either include this in the links:
Code:
<a href="javascript:document.getElementById('contentarea').scrollTop=0;ajaxpage('news.html', 'contentarea');" class="navlink">NEWS</a>
Or make up a function for it and invoke it each time (put this inside a script block or on an external script linked to the page):
Code:
function resetS(){
document.getElementById('contentarea').scrollTop=0;
}
Then you can do:
Code:
<a href="javascript:resetS();ajaxpage('news.html', 'contentarea');" class="navlink">NEWS</a>
Bookmarks