转自:http://blog.csdn.net/duckur/archive/2005/11/29/539093.aspx
1<div id="mydiv" style="overflow:scroll;width:100;height:100" οnscrοll="testScroll()">
...
</div>
2
<script language="javascript">
var x;
var y;
function window.onload()
{
x = mydiv.scrollLeft;
y = mydiv.scrollTop;
}
function testScroll()
{
if (x != mydiv.scrollLeft)
{
x = mydiv.scrollLeft;
alert("horizontal");
}
if (y != mydiv.scrollTop)
{
y = mydiv.scrollTop;
alert("vertical");
}
}
</script>