<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
var x;var y;var flag=false;
function clicks(){
x=event.offsetX;
y=event.offsetY;
flag=true;
}
function mover(){
if(flag==true){
var obj=document.getElementById("movess");
obj.style.left=event.clientX-x+"px";
obj.style.top=event.clientY-y+"px";
}
}
function out(){
flag=false;
}
</script>
<style type="text/css">
#movess{
height:200px; width:200px; background-color:#0F0;
position:absolute;
top:100px;
left:100px;
}
</style>
</head>
<body>
<div id="movess" οnmοusedοwn="clicks()" οnmοusemοve="mover()" οnmοuseup="out()" οnmοuseοut="out()">
sssssssss
</div>
</body>
</html>