<html>
<head>
<title>javascript gets the current mouse coordinates</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<script type="text/javascript">
function mousePosition(ev){
if( || ){//firefox, chrome and other browsers
return {x:,y:};
}
return {// IE browser
x: + - ,
y: + -
};
}
function mouseMove(ev){
ev = ev || ;
var mousePos = mousePosition(ev);
('x').innerHTML = ;
('y').innerHTML = ;
}
= mouseMove;
</script>
<style type="text/css">
h3{color:blue;}
p{line-height:30px;height:30px;font-size:14px;width:500px;}
span{color:orange;font-weight:bold;}
</style>
</head>
<body>
<h3>Your mouse has been tracked</h3>
<p> X-axis coordinates: <span></span></p>
<p> Y-axis coordinates: <span></span></p>
</body>
</html>
<head>
<title>javascript gets the current mouse coordinates</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<script type="text/javascript">
function mousePosition(ev){
if( || ){//firefox, chrome and other browsers
return {x:,y:};
}
return {// IE browser
x: + - ,
y: + -
};
}
function mouseMove(ev){
ev = ev || ;
var mousePos = mousePosition(ev);
('x').innerHTML = ;
('y').innerHTML = ;
}
= mouseMove;
</script>
<style type="text/css">
h3{color:blue;}
p{line-height:30px;height:30px;font-size:14px;width:500px;}
span{color:orange;font-weight:bold;}
</style>
</head>
<body>
<h3>Your mouse has been tracked</h3>
<p> X-axis coordinates: <span></span></p>
<p> Y-axis coordinates: <span></span></p>
</body>
</html>