//窗口随意移动
function window_move(object){
$(object).mousedown(function(){
var event=window.event||arguments.callee.caller.arguments[0];
var left=event.clientX;
var top=event.clientY;
$(document).mousemove(function(){
var event=window.event||arguments.callee.caller.arguments[0];
var moveleft=parseInt($(object).css('left'))+(event.clientX-left);
var movetop=parseInt($(object).css('top'))+(event.clientY-top);
left=event.clientX;top=event.clientY;//重置新坐标位置
$(object).css({left:moveleft+"px",top:movetop+"px"});
});
})
$(document).mouseup(function(){
$(document).off('mousemove');
})
}
使用的话把需要移动的窗口最外层对象传给他
window_move(object)
需要用到juqery