Well im working on this script for class that is suppose to have an image follow around the mouse as the mouse moves around the screen but if the user double clicks the image will stay put and disable the image from following the mouse until the user double clicks again then it will start following the mouse again. well i dont want anyone to give me code on how to do this i just would like some help on getting the image to stay put on the double click. here is the code i currently have that makes the image follow the mouse pointer.
<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- onmousemove.html -->
<!-- Demonstrating the onmousemove event -->
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>DHTML Event Model - onmousemove event</title>
<script type = "text/javascript">
<!--
function updateMouseCoordinates()
{
coordinates.innerText = event.srcElement.tagName +
" (" + event.offsetX + ", " + event.offsetY + ")";
}
function follow()
{
myImage.style.top = event.y;
myImage.style.left = event.x;
}
function stay()
{
myImage.style.top = event.y;
myImage.style.left = event.x;
}
document.ondblclick = stay;
document.onmousemove = follow;
// -->
</script>
</head>
<body style = "background-color: wheat" onmousemove = "updateMouseCoordinates()">
<img id="myImage" src = "orange.gif" style = "position: absolute;
top: 100; left: 100" alt="orange" />
</body>
</html>
again im just looking for ideas on how to do this we are suppose to use
CSS absolute positioning,
onmousemove and
event.x/event.y to have an image follow the mouse as the user moves the mouse over the Web page. Disable this feature if the user double clicks (
ondblclick). thats the actuall assignment if i didnt explain it well.