读书人

Jquery兑现复选框的左右交换

发布时间: 2012-12-16 12:02:32 作者: rapoo

Jquery实现复选框的左右交换
选项过去啦但文本没有


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>

<body>

<SCRIPT type="text/javascript" src="http://localhost:8888/ssh_oa//js/jquery-1.8.2.min.js"></SCRIPT>
<script language="JavaScript" type="text/JavaScript">

function remove(){
$('#select1 input:checked').appendTo('#select2');
}
//-->
</script>
</head>
<table width="200">
<tr>
<td>左面</td>
<td>右面</td>
</tr>
<tr>
<td id="select1">
<input type="checkbox">复选1<br/>
<input type="checkbox">复选2<br/>
<input type="checkbox">复选3<br/>
<input type="checkbox">复选4<br/>
<input type="checkbox">复选5<br/>
<input type="checkbox">复选6<br/>
</td>
<td id="select2">
<input type="checkbox">复选7<br/>
</td>
</tr>
</table>
<input type="button" value="移到右面" onClick="remove()" >
</body>
</html>

[最优解释]
<input type="checkbox">复选</input>
这样试试

[其他解释]
试过啦不行啊
[其他解释]
我解决啦
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>

<body>

<SCRIPT type="text/javascript" src="jquery-1.8.2.min.js"></SCRIPT>
<script language="JavaScript" type="text/JavaScript">

function remove(){

$("#select2").append($('#select1 input:checked').attr("checked", false).parent());
;
}

function left(){

$("#select1").append($('#select2 input:checked').attr("checked", false).parent());
}
//-->
</script>
<table width="200">
<tr>
<td>左面</td>
<td>右面</td>
</tr>
<tr>
<td>
<ol id="select1">
<li><input type="checkbox" />我</li>
<li><input type="checkbox" />会</li>


<li><input type="checkbox" />j</li>
<li><input type="checkbox" />u</li>
<li><input type="checkbox" />e</li>
</ol>
</td>
<td>
<ol id="select2">
<li><input type="checkbox" />r</li>
<li><input type="checkbox" />y</li>
</ol>
</td>
</tr>
</table>
<input type="button" value="移到右面" onClick="remove()" >
<input type="button" value="移到左面" onClick="left()" >
</body>
</html>

读书人网 >J2EE开发

热点推荐