Tip: you can modify some code before running
<!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><title>Www.111cn.net drag layer</title><meta http-equiv="content-type" content="text/html;charset=gb2312"><!--把下面代码加到<head>与</head>之间--><style type="text/css">* {Padding: 0px auto; margin: 0px auto;} body {font-size: 12px; font-family: ;}. a1 {width: 135px; height: 100px; border: 1px solid red; float: left; background: lightgreen; margin: 5px; padding: 5px ;}. a2 {width: 135px; height: 100px; border: 1px solid red; float: right; background: lightgreen; margin: 5px; padding: 5px ;}</style><script language="javascript">Function tuo () {var objthis = this; this. x = null; this. y = null; this. xx = null; this. yy = null; this. xxx = null; this. yyy = null; this. obja = null; this. co = null; this. t = null; document. onmousemove = function () {try {objthis. x = arguments [0]. screenX; objthis. y = arguments [0]. screenY;} catch (err) {objthis. x = window. event. x; objthis. y = window. event. y ;}} tuo. prototype. create = function (a, B) {if (this. obja = null) {this. co = B; var objthis = this; this. obja = a; this. obja. onmouseup = function () {objthis. up ()} this. xx = this. x; this. yy = this. y; this. xxx = this. obja. offsetLeft; this. yyy = this. obja. offsetTop; this. obja. style. position = "absolute"; this. move () ;}} tuo. prototype. move = function () {var objthis = this; var x = this. xxx + this. x-this. xx; var y = this. yyy + this. y-this. yy; this. obja. style. left = x + "px"; this. obja. style. top = y + "px"; this. t = setTimeout (function () {objthis. move ()}, 1)} tuo. prototype. up = function () {clearTimeout (this. t) if (this. co = 1) {this. obja. style. left = this. xxx + "px"; this. obja. style. top = this. yyy + "px";} this. xxx = null; this. yyy = null; this. obja = null;} var PC3 = new tuo ();</script></head><body><!--把下面代码加到<body>与</body>之间--><div class="a1" onmousedown="cc1.create(this,1)">Automatically restored to the original drag layer</div><div class="a2" onmousedown="cc1.create(this)">Do not restore to the original drag layer</div></body></html>
Tip: you can modify some code before running