HTML, XHTML and CSS All-In-One for Dummies - Andy Harris [187]
e = window.event;
} // end IE catch
//get width and height
height = parseInt(sprite.style.height);
width = parseInt(sprite.style.width);
//move center of sprite to mouse
x = e.pageX - (width/2);
y = e.pageY - (height/2);
sprite.style.left = x + “px“;
sprite.style.top = y + “px”;
} // end function
Move the mouse and the ball will follow
style = ”position: absolute;
left: 100px;
top: 100px;
width: 50px;
height: 50px;”>

alt = ”ball” />