<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>22-鼠标移动事件</title>
<style type="text/css">
div{
width:300px;
height:300px;
border:1px solid red;
}
</style>
<script type="text/javascript">
<!--
function fun(e){
var a=document.getElementById('txt');//拿到对象
a.value=e.clientX+':'+e.clientY;
}
//-->
</script>
</head>
<body>
<input type="text" name="" id='txt'>
<div onmousemove='fun(event)'></div>
</body>
</html>
转载于:https://my.oschina.net/YongfengHe/blog/646224