Передавай первым аргументом ссылку на див. Неужели непонятно по коду? В твоем случае
<a href="javascript:pageScroll(document.getElementById('left'))"> </a>
Тогда так:
<!DOCTYPE HTML>
<html>
<head> </head>
<body>
<script>
function scroll_into_bottom(element, step, delay) {
if (step == undefined) step = 10;
if (delay == undefined) delay = 10;
element.scrollTop += step;
window.scroll_timeout = setTimeout(function(){scroll_into_bottom(element, step, delay)}, delay);
}
</script>
<div id="mydiv" style="height: 100px; overflow-y: scroll; background-color: blue;">
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
<button onclick="scroll_into_bottom(document.getElementById('mydiv'))">Scroll into bottom!</button>
<button onclick="clearTimeout(scroll_timeout)">Stop scrolling!</button>
</body>
</html>
|