i done one concept of program is find out mouse coordinate position inside div element … its perfectly working in IE browser only but i cant get answer in mozilla firefox… what is the reason??????????
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Cursor position status display</title>
<script type="text/javascript">
function getXOffset(e){
if(typeof e.offsetX != 'undefined')
return e.offsetX;
else if(typeof e.pageX != 'undefined')
return e.pageX - e.target.offsetLeft;
}
function getYOffset(e){
if(typeof e.offsetY != 'undefined')
return e.offsetY;
else if(typeof e.pageY != 'undefined')
return e.pageY - e.target.offsetTop;
}
function displayOffsets(e){
e = (e) ? e : window.event;
window.status = 'x: '+getXOffset(e)+' y: '+getYOffset(e);
}
</script>
</head>
<body>
<div style="width:100px; height:300px;margin:50px 0 0 500px;border:1px solid red;" >
<div onMouseMove="displayOffsets(event)" style="width:50px; height:300px; background:#669966;"></div>
<div >
</body>
</html>
Your function may be working perfectly fine, your problem is probably the
window.statuspart: https://developer.mozilla.org/en/DOM/window.statusMaybe try outputing the coordinates into some other element in the page, or better yet, if you have something like Firebug, you can output use the console.