<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
$(document).ready(function() {//上移处理
$("#btn_up").click(function(){
var htm ='';
$("input[name=check_box_show]").each(function(){
if($(this).attr('checked')){
htm += $(this).val();
//alert($(this).parents("tr").clone(true));判断是否第一条,第一条不移动
if($(this).val()==$("#tab_show_info :first-child :checkbox").val()){alert("'"+$(this).parents("td").text() +"' is the First !");
return ;
}
//向上移动
$(this).parents("tr").prev("tr").before(
$(this).parents("tr").clone(true));
$(this).parents("tr").remove();//删除当前的
}
});
if(htm ==''){
alert('Please Select "Show Information"!');
}
});
$("#btn_down").click(function(){
var htm ='';
//alert();
$("input[name=check_box_show]").each(function(){
if($(this).attr('checked')){
htm += $(this).val();
//alert($(this).parents("tr").clone(true));判断是中最后一条
if($(this).val()==$("#tab_show_info :last-child :checkbox").val()){
alert("'"+$(this).parents("td").text() +"' is the Last !");
return ;
}
//复制并向下移动
$(this).parents("tr").next("tr").append(
$(this).parents("tr").clone(true));
$(this).parents("tr").remove();//删除当前的
}
});
if(htm ==''){
alert('Please Select "Show Information"!');
}
});
});
</script>
</head>
<body class="elite">
<div style="float:left;width:470px;">
<table class="ctrtable" width="100%" align="right" id="tab_show_info">
<c:forEach items="${showPropertys}" var="property">
<tr>
<td>
<input type="checkbox" name="check_box_show" value="avaProperty1" />
ap1
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="check_box_show" value="avaProperty3" />
ap2
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="check_box_show" value="avaProperty3" />
ap3
</td>
</tr>
</c:forEach>
</table>
</div>
<div style="float:left;width:50px;padding-top:100px;">
<span style="padding-top: 10px;padding-botton:10px;margin-top:10px;margin-botton:10px;">
<a class="button-b" id="btn_up"><span> Up </span> </a>
</span>
<br/>
<br/>
<br/>
<span style="padding-top: 10px;padding-botton:10px;margin-top:10px;margin-botton:10px;">
<a class="button-b" id="btn_down"><span>Down</span> </a>
</span>
<br/>
<br/>
</div>
</body>
</html>