I have this javascript below, which when I put my mouse over the link, it scrolls up, but it causes my browser to hang. Is there any way for this to work, so when I put my mouse over, it goes, but when I leave the link, it stops?
Code:
<html>
<head><title>Scrolling a DIV with JavaScript</title>
<script language='javascript'>
var l = 1;
function move_up() {
do {
document.getElementById('scroll_clipper').scrollTop = document.getElementById('scroll_clipper').scrollTop-5;
} while(l==1)
}
function stopscroll() {
l = 0;
}
</script>
</head>
<body>
<a href='#' onmouseover="move_up()" onmouseout="stopscroll()" >Move UP</a>
<p>
<div id='scroll_clipper' style='position:absolute; width:150px; height: 150px; overflow:auto'>
<div id='scroll_text' style='background-color:yellow'>
Here is some content that can be scrolled.
<p>It uses two divs:<ul>
<li>scroll_clipper, and
<li>scroll_text
</ul>
scroll_clipper defines the scroll area while scroll_text
defines the text to be scrolled.
</div>
</div>
</body>
</html>