Code
< Script Language = " Javascript " Type = " Text/JavaScript " >
$ ( Function (){
$. FN. Extend ({movediv: Function (){
VaR Coordinate = Function (){};
Coordinate. offsetx = 0 ;
Coordinate. offsety = 0 ;
Coordinate. OBJ = This ;
State = False ;
$ ( This ). Mousedown ( Function (Event ){
State = True ;
Coordinate. offsetx = Event. offsetx;
Coordinate. offsety = Event. offsety;
});
$ ( This ). Mouseup ( Function (){
State = False ;
});
$ ( " Body " ). Mousemove ( Function (Event ){
If (State ){
VaR Leftp = Event. clientx - Coordinate. offsetx;
VaR Topp = Event. clienty - Coordinate. offsety;
Certificate (coordinate.obj).css ({ " Left " : Leftp, " Top " : Topp });
Certificate (coordinate.obj).html (leftp );
}
});
}
});
$ ("# D"). Movediv ();
});
</SCRIPT>
< Body >
< Form ID = "Form1" Runat = "Server" >
< Div ID = "D" >
</ Div >
</ Form >
</ Body >
Because dragging is a combination event .. Therefore, using extensions, these combined events are defined as a new feature.