我有几个文字做到层里了,怎么能限制这个层的拖动范围,并取到这个层随意在这个限制区域拖动的坐标?
<div style='position:absolute;width:200;height:200;' onmousedown=MouseDown(this) onmousemove=MouseMove() onmouseup=MouseUp()><fon t color=red>可以拖动我</font></div>
<script>
var Obj
function MouseDown(obj){
Obj=obj
Obj.setCapture()
Obj.l=event.x-Obj.style.pixelLeft
Obj.t=event.y-Obj.style.pixelTop
}
function MouseMove(){
if(Obj!=null){
}
}
</script>
<div style='position:absolute;width:200;height:200;' onmousedown=MouseDown(this) onmousemove=MouseMove() onmouseup=MouseUp()><fon t color=red>可以拖动我</font></div>
<script>
var Obj
function MouseDown(obj){
Obj=obj
Obj.setCapture()
Obj.l=event.x-Obj.style.pixelLeft
Obj.t=event.y-Obj.style.pixelTop
}
function MouseMove(){
if(Obj!=null){
}
}
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货