View Single Post
  #3 (permalink)  
Old February 12th, 2008, 04:35 AM
joefawcett's Avatar
joefawcett joefawcett is offline
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

After a little experimenting I think the problem is your use of setTimeout. If you move that into a separate function then it works:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>OnScroll Test</title>
<style type="text/css">
</style>
<script type="text/javascript">

function showScroll(x, y)
{
  var oOutput = document.getElementById("divOutput");
  oOutput.innerHTML += "screenX: " + x + ", screenY: " + y + "<br />";
}

function delayShowScroll()
{
  setTimeout("showScroll(" + event.screenX + ", " + event.screenY + ")", 1000);
}

window.onscroll = delayShowScroll;
</script>
</head>

<body>
<div id="divOutput" style="border: 2px solid #c0c0c0; height: 600px; width: 200px; position: relative"></div>
</body>
</html>
--

Joe (Microsoft MVP - XML)
Reply With Quote