让元素mouseover的时候接收吧----------------------------------------
var mouseDownFlag=false;//鼠标是否按下的标志document.onmousedown=function(){
mouseDownFlag=true;//鼠标按下将标志置true
}document.onmouseup=function(){
mouseDownFlag=false;//鼠标松开将标志置false
}window.onload=function(){
drag(document.getElementById('drag'),[200,400,30,30]);
for(var i=0;i<document.body.childNodes.length;i++){
document.body.childNodes[i].onmouseover=function(){
if(mouseDownFlag){
alert("移过来了");
mouseDownFlag=false;
}
}
}
};
var mouseDownFlag=false;//鼠标是否按下的标志document.onmousedown=function(){
mouseDownFlag=true;//鼠标按下将标志置true
}document.onmouseup=function(){
mouseDownFlag=false;//鼠标松开将标志置false
}window.onload=function(){
drag(document.getElementById('drag'),[200,400,30,30]);
for(var i=0;i<document.body.childNodes.length;i++){
document.body.childNodes[i].onmouseover=function(){
if(mouseDownFlag){
alert("移过来了");
mouseDownFlag=false;
}
}
}
};
onmouseover->
遍历你table下所有cell的坐标,如果cell坐标在你现在浮动的DIV坐标范围内,则高亮,否则跳过
onmouseup->判断坐标在哪个cell的范围内,并swapNode或return;