I am using a div and want it to move with mouse coordinates. I don't know what is wrong. Or the method I am using is wrong. Please help!
<!DOCTYPE html>
<html>
<head>
<title>JavaScript</title>
<script></script>
<style>
#box{
background:cyan;
height:100px;
width:100px;
}
</style>
</head>
<body onLoad="placeBox()">
<div id="box"></div>
<script>
function placeBox(){
var x = event.clientX;
var y = event.clientY;
var d = document.getElementById('box');
d.style.position = "absolute";
d.style.left = x+'px';
d.style.top = y+'px';
}
setInterval("placeBox()", 1);
</script>
</body>
</html>