html>
Title Pagediv {
position: absolute;
left: 0;
top: 0;
background: red;
100px;
height: 100px;
}
$('div').mousedown(function () {
e = window.event;
// 重点重点重点重点重点重点重点重点重点重点重点
if (e.stopPropagation) e.stopPropagation();
if (e.preventDefault) e.preventDefault();
e.cancelBubble = true;
e.returnValue = false;
$('img').dragstart = false
x = e.screenX
y = e.screenY
left = $('div').css('left')
tops = $('div').css('top')
document.onmousemove = function () {
e = window.event;
var newx = e.screenX
var newy = e.screenY
nowLeft = parseInt(left) + parseInt(newx) - parseInt(x)
nowTop = parseInt(tops) + parseInt(newy) - parseInt(y)
$('div').css('left', nowLeft + "px")
$('div').css('top', nowTop + "px")
}
document.onmouseup = function () {
document.onmousemove = null
document.mousedown = null
}
})