Determine scroll position while using overflow

i have a list that has a set height of 100 pixels. the overflow property is set to ‘auto’, that way a scroll bar appears if the list gets too crowded.

<ul style="height: 100px; overflow: auto;">
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
</ul>

i’m wanting a way to reset the scroll position to the top of the list. anyone know how i can do this? thanks!

The scrollTop property is what you’re after
http://www.quirksmode.org/dom/w3c_cssom.html


.scrollbox {
    height: 100px;
	overflow: auto;
}


<ul id="myScrollbox" class="scrollbox">
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
</ul>
<p><input id="scrollTop" type="button" value="Scroll to top"></p>


function scrollToTop(el) {
	el.scrollTop = 0;
}
document.getElementById('scrollTop').onclick = function () {
	var el = document.getElementById('myScrollbox');
    scrollToTop(el);
};

Or in full:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Scroll test</title>
<style type="text/css">
.scrollbox {
    height: 100px;
	overflow: auto;
}
</style>
</head>
<body>
<ul id="myScrollbox" class="scrollbox">
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
     <li>Testing</li>
</ul>
<p><input id="scrollTop" type="button" value="Scroll to top"></p>
<script type="text/javascript">
function scrollToTop(el) {
	el.scrollTop = 0;
}
document.getElementById('scrollTop').onclick = function () {
	var el = document.getElementById('myScrollbox');
    scrollToTop(el);
};
</script>
</body>
</html>