最近在写一个会议自动排座系统。在网上搜索了一下资料后。 DIV层的类容可以进行交换。 现又被一问题困扰。 
  如何把交换后的数据插入到数据库中。 在此小弟恳求大家给个思路。
  staff是座位用 ,1-1,1-2 ,2-1 ,2-2表示
<%@ page language="java" import="java.util.*,com.staff.entity.*"
pageEncoding="gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
.opacity {
opacity: 0.5;
filter: alpha(opacity =       50);
margin: 0px;
padding: 0px;
cursor: move;
}.border {
border: 1px dashed #FC6;
background: #fff;
}.black {
background: #44F4F9;
border-color: #CCC
}
</style>
</head> <body>
<center>
<form action="save_File">
<button type="submit">保存</button>
<table border="1" bordercolor="#FC9">
<%
int k = 1;
List list = (List) request.getAttribute("list");
for (int i = 1; i <= 10; i++) { //控制行
%>
<tr>
<%
for (int j = 1; j <= 10; j++) { //控制列
%>
<td>

<span style="background-color: ; width: 80; height: 50;">
<div id="div_<%=k++%>" style="background-color:#ece;border:1px solid #eac;float:left;width: 80; height: 50;">
<%
String staff_z = i + "-" + j;
for (int b = 0; b < list.size(); b++) {
Staff_t staff_t = (Staff_t) list.get(b);
if (staff_z.equals(staff_t.getSeat())) {
%> <%=staff_t.getName()%> <%
  }
  }
 %></div><font color="#ece">座位<%=staff_z%></font>
</span>

<br/>



</td>
<%
}
%> </tr>
<%
}
%> </table>
</form>
</center>
<script type="text/javascript">
/*
使用规则:1,必须在CSS样式表里添加如下CSS类:
.opacity{
opacity:0.5;
filter:alpha(opacity=50);
margin:0px;
padding:0px;
cursor:move;
}
.border{
border:1px dashed #FC6;
background:#fff;
}
.black{
background:#EEF4F9;
border-color:#CCC
}
**类的属性可自定义
**最好保持类的独立性,不要类似.a.b.c{}这样的。
**在页面加载完毕时调用或将此JS加在页面最底部,调用方式:sang(elems),elems可以是单个ID,如"id1",也可以是一个元素对象,也可以是多个ID的数组,或元素对象的集合。
**如:要控制页面中ID为 id1,id2,id3的元素,即sang(['id1','id2','id3']),如要控制某父元素下的所有子元素,可用:sang(父元素对象.document.getElementsByTagName("元素名"))
*/
var sang=function(elems){
  var leng,elms=[];
  var ox,oy,x2,y2,ocls,mvid,ismv=false;
  if(isArray(elems)){
    leng=elems.length;
for(var i=0;i<leng;i++){
elms[i]=document.getElementById(elems[i])
}
  }
  else if(typeof elems=="string"){
elms[0]=document.getElementById(elems);
leng=1;
  }
  else{
    if(elems.length){
  elms=elems;
  leng=elems.length;
}
else{
  elms[0]=elems;
  leng=1;
}
  }
  function isArray(o) {  
return Object.prototype.toString.call(o) === '[object Array]';   
  }  
  var w={
  x:function(){
      return event.clientX+Math.max(document.documentElement.scrollLeft,document.body.scrollLeft);
    },
  y:function(){
      return event.clientY+Math.max(document.documentElement.scrollTop,document.body.scrollTop);
    }
  };
  function getpos(obj){
var w={};
w.x=obj.offsetLeft;
w.y=obj.offsetTop;
w.w=obj.offsetWidth;
w.h=obj.offsetHeight;
while(obj=obj.offsetParent){
        w.x+=obj.offsetLeft
    w.y+=obj.offsetTop
}
return w;
  }
  function down(obj){
    var div=document.createElement("div");
ox=getpos(obj).x;
oy=getpos(obj).y;
x2=w.x();y2=w.y();
ocls=obj.className;
div.className=obj.className+" opacity";
div.innerHTML=obj.innerHTML;
div.id=obj.id+'mvid',
div.style.position="absolute";
div.style.left=ox+2+"px";
div.style.top=oy+2+"px";
obj.className+=" border";
obj.innerHTML="";
document.body.appendChild(div);
mvid=document.getElementById(obj.id+'mvid');
ismv=true;
  }
  function move(obj){

  }
  function init(e){
for(var i=0;i<leng;i++){
  e[i].onmousedown=function(){
down(this);
var self=this;
document.onmousemove=function(){
  mvid.style.left=w.x()-(x2-ox)+"px";
  mvid.style.top=w.y()-(y2-oy)+"px";
  for(var i=0;i<leng;i++){
var eW=getpos(e[i]);
    var ex=eW.x,ey=eW.y,ew=eW.w,eh=eW.h;
if(w.x()>ex && w.y()>ey && w.x()<ex+ew && w.y()<ey+eh){
  if(e[i].id!=mvid.id.replace(/mvid/g,"")){
e[i].className+=" black";
  }
}
else{
  e[i].className=e[i].className.replace(/ black/g,'')
}
  }
  return false
}//document.onmousemove  END
document.onmouseup=function(){
  document.onmousemove={};
  for(var i=0;i<leng;i++){
var eW=getpos(e[i]);
    var ex=eW.x,ey=eW.y,ew=eW.w,eh=eW.h;
if(w.x()>ex && w.y()>ey && w.x()<ex+ew && w.y()<ey+eh){
  if(e[i].id!=mvid.id.replace(/mvid/g,"")){
    self.innerHTML=e[i].innerHTML;
self.className=e[i].className.replace(/ black/g,"");
self.id=e[i].id;
e[i].className=mvid.className.replace(/ opacity/g,"");
e[i].innerHTML=mvid.innerHTML;
e[i].id=mvid.id.replace(/mvid/g,'');
document.body.removeChild(mvid);
ismv=false;
break;
  }
}
  }//for END
  if(ismv){
self.innerHTML=mvid.innerHTML;
self.className=ocls;
document.body.removeChild(mvid);
ismv=false;
 }
}//document.onmouseup END
return false
  }//e[i].onmousedown END
}//for END
  }//init END
  init(elms);
}
sang(document.getElementsByTagName('div'))
</script>
</body>
</html>