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" class="conids"/></td>
<td><a href="#" onclick="check(this)">上移</a></td>
</tr>
</table>
<table id="table2">
<tr>
<td>22222222222222</td>
<td>bbbbbbbbbbbbbb<input type="hidden" name="test" value="222" class="conids"/></td>
<td><a href="#" onclick="check(this)">上移</a></td>
</tr>
</table>
<table id="table3">
<tr>
<td>33333333333333</td>
<td>cccccccccccccc<input type="hidden" name="test" value="333" class="conids"/></td>
<td><a href="#" onclick="check(this)">上移</a></td>
</tr>
</table>
<table id="table4">
<tr>
<td>44444444444444</td>
<td>dddddddddddddd<input type="hidden" name="test" value="444" class="conids"/></td>
<td><a href="#" onclick="check(this)">上移</a></td>
</tr>
</table>
</div>
</body>
</html> 相关推荐
思君夜未眠 2020-09-04
行吟阁 2020-08-09
表格的现在还是较为常用的一种标签,但不是用来布局,常见处理、显示表格式数据。在HTML网页中,要想创建表格,就需要使用表格相关的标签。<table> <tr> <td>单元格内的文字</td> ...
gufudhn 2020-08-09
SCNUHB 2020-11-10
FellowYourHeart 2020-10-05
jessieHJ 2020-08-19
末点 2020-08-03
nimeijian 2020-07-30
好记忆也需烂 2020-07-28
zlsdmx 2020-07-05
tomson 2020-07-05
tianqi 2020-07-05
onlykg 2020-07-04