jquery实现上下移动table列,并将排序保存至数据库
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><script language="javascript" src="jquery-1.4.2.min.js"></script><script type="text/javascript"> function check(t){ var cur = $(t).parent().parent().parent().parent(); var pre=cur.prev('table'); var sr = $(t).parent().parent().parent().parent().prev('table').find(".conids").val(); if(pre.length !=0){ $.ajax({ type:"post", url:"${website}/admin/ajax/cute_moveUpConRS.xhtml", data:"&conId=" +conId+"&pid="+pid+"&upConId="+upConId, timeout:20000, error:function() { alert('上移未执行成功!'); }, dataType:"json", success:function(data) { cur.insertBefore(pre); } }); }else{ alert("已经是最顶部了!"); } }</script><title>无标题文档</title></head><body><div><ul id="ul1"> <li><input type="text" name="test" /></li></ul><table id="table1"> <tr> <td>11111111111111</td> <td>aaaaaaaaaaaaaa<input type="hidden" name="test" value="111" onclick="check(this)">上移</a></td> </tr></table><table id="table2"> <tr> <td>22222222222222</td> <td>bbbbbbbbbbbbbb<input type="hidden" name="test" value="222" onclick="check(this)">上移</a></td> </tr></table><table id="table3"> <tr> <td>33333333333333</td> <td>cccccccccccccc<input type="hidden" name="test" value="333" onclick="check(this)">上移</a></td> </tr></table><table id="table4"> <tr> <td>44444444444444</td> <td>dddddddddddddd<input type="hidden" name="test" value="444" onclick="check(this)">上移</a></td> </tr></table></div></body></html>?