//获取坐标位置 function getPosition(ev){ ev = ev || window.event; var point = {x:0,y:0}; if(ev.pageX || ev.pageY){ point.x = ev.pageX; point.y = ev.pageY; } else {//兼容ie point.x = ev.clientX + document.body.scrollLeft - document.body.clientLeft; point.y = ev.clientY + document.documentElement.scrollTop; } return point; }