SoFunction
Updated on 2025-04-11

Supports mouse pointer effects for dragging and dragging under IE, firefxo, and Chrome browsers

Core code:

<!DOCTYPE html>
<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mouse drag and drag mouse pointer effects</title>
<style>
#box{width:100px;height:100px;background:#966;position:absolute;left:100px;top:100px;cursor:pointer;}
</style>
</head>
<body>
<div ></div>
<script>
var doc=document;
function getViewport(){
  return {width:(,),
      height:(,)
  };
}
function compareNum(x,minNum,maxNum){
 switch(true){
 case x<minNum:x=minNum;break;
 case x>maxNum:x=maxNum;break;
 default:x;
 }
 return x;
 }

='100px'
='100px'

=function(e){
 var e=e||;
 var maxL=getViewport().width-100,
   maxT=getViewport().height-100;
 =parseInt();
 =parseInt();
 //alert()
 =;
 =;
 //alert(maxL+':'+maxT+':'+L+':'+T)
 =function(e){
 posXY(e,0,0,maxL,maxT);
 };
 =function(){
  =null;
 =null;
 };
 return false;
}
function posXY(e,minL,minT,maxL,maxT){
  var e=e||;
 var x=-();
 var y=-();
 =compareNum(x,minL,maxL)+'px'
 =compareNum(y,minT,maxT)+'px'
}
</script>
</body>
</html>


[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]