看看效果如何<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="Microsoft FrontPage 5.0">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script type="text/javascript">
window.d0bj=null;document.onmousemove=function(v){if(d0bj!=null){v=v?v:(window.event?window.event:null);if(typeof(lastX)=="undefined"||lastX==null){lastX=v.screenX;lastY=v.screenY;return;}var x=v.screenX-lastX;var y=v.screenY-lastY;
lastX=v.screenX;lastY=v.screenY;d0bj.move(x,y);}};document.onmouseup=function(v){d0bj=null;lastX=null;};function df(obj){obj.style.position="absolute";if(obj.style.top=="")obj.style.top="0px";if(obj.style.left=="")obj.style.left="0px";obj.group=null;obj.move=function(x,y){this.style.top=parseInt(this.style.top)+y+"px";this.style.left=parseInt(this.style.left)+x+"px";};window.selObj=null;obj.onmousedown=function(v)
{v=v?v:(window.event?window.event:null);if(v.ctrlKey){if(selObj==null){d0bj=this.group;selObj=this.group;}else{if(selObj.dds.length>1&&this.group.dds.length>1){alert("禁止两组相加");}else{d0bj=dd(selObj,this.group);selObj=d0bj;}}document.onkeyup=function(){window.selObj=null;}}else{d0bj=this.group;}}};
function dg(){this.dds=[];this.move=function(x,y){for(var i=0; i < this.dds.length; i++){this.dds[i].move(x, y);}};this.dvd = function(item){this.dds.push(item);item.group = this;}};window.onload = function(){N=6;var dgg=new Array(N);for(i=1;i<N+1;i++){df(document.getElementById("obj"+i));dgg[i-1]=dd1("objG"+i);
dgg[i-1].dvd(document.getElementById("obj"+i));}};function dd1(obj){obj = new dg();return obj;} function dd(k,n){for(var i=0;i< n.dds.length; i++){k.dvd(n.dds[i]);}return k;}
</script></HEAD><BODY><div style="position: absolute; top: 0; left: 0; width: 75; height: 71;background:#e50" id=obj1>obj1<br></div>
<div style="position: absolute; top: 30; left: 130; width: 75; height: 71;background:#f90" id=obj2>obj2<br></div>
<div style="position: absolute; top: 20; left: 300; width: 75; height: 71;background:#8df" id=obj3>obj3<br></div>
<br>
<br>
<br>
<br>
<br>
<div style="position: absolute; top: 53; left: 480; width: 75; height: 71;background:#DDD" id=obj4>obj4<br></div>
<div style="position: absolute; top: 177; left: 554; width: 75; height: 71;background:#789" id=obj5>obj5<br></div>
<div style="position: absolute; top: 233; left: 428; width: 75; height: 71;background:#869" id=obj6>obj6<br></div>
<br>
<br>
</BODY>
</HTML>