帮忙写个js
废话不多说,先上代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<script language="javascript">
function moveText() {
var input = document.createElement('input');
input.name = "txtRsv";
input.type = 'text';
input.style.width = '70%';
input.style.marginTop = '5px';
input.style.marginLeft = '10px';
document.getElementById("RsvDiv").appendChild(input);
var input1 = document.createElement('input');
input1.type = 'button';
input1.value = '删除';
document.getElementById("RsvDiv").appendChild(input1);
var input2 = document.createElement('input');
input2.type = 'button';
input2.value = '移至未解决';
document.getElementById("RsvDiv").appendChild(input2);
}
</script>
<body>
<table style="width: 100%;">
<tr>
<td class="auto-style8" colspan="6" valign="top">
<div style="margin-top: 10px; margin-left: 60px">
<a style="float: left">已解决:</a>
<div id="RsvDiv" style="margin-left: 50px; width: 960px;">
<input name="txtRsv" type="text" style="margin-top: 5px; margin-left: 10px; width: 70%;" />
<input id="Button1" type="button" value="删除" /> <input id="Button7" type="button" value="移至未解决" /><br />
</div>
</div>
<br />
<div style="margin-top: 10px; margin-left: 60px;">
<a style="float: left">未解决:</a>
<div id="UnRsvDiv" style="margin-left: 50px; width: 960px;">
<input name="txtUnResv" type="text" value="" style="margin-top: 5px; margin-left: 10px; width: 70%;" />
<input id="Button5" type="button" value="删除" /> <input id="Button6" type="button" value="移至已解决" onclick="moveText()" />
<br />
</div>
</div>
</td>
</tr>
</table>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title></title>
</head>
<script language="javascript">
function moveItem(btn, ok) {
var targetID = ok ? 'RsvDiv' : 'UnRsvDiv';
document.getElementById(targetID).appendChild(btn.parentNode);
btn.onclick = function () { moveItem(this, !ok); }
btn.value = ok ? '移至未解决' : '移至已解决';
}
function DelItem(btn) {var item = btn.parentNode, p = item.parentNode;p.removeChild(item);}
</script>
<body>
<table style="width: 100%;">
<tr>
<td class="auto-style8" colspan="6" valign="top">
<div style="margin-top: 10px; margin-left: 60px">
<a style="float: left">已解决:</a>
<div id="RsvDiv" style="margin-left: 50px; width: 960px;">
<div>
<input name="txtRsv" type="text" style="margin-top: 5px; margin-left: 10px; width: 70%;" value="1" />
<input id="Button1" type="button" value="删除" onclick="DelItem(this)" /> <input id="Button7" type="button" value="移至未解决" onclick="moveItem(this)" />
</div><div>
<input name="txtRsv" type="text" style="margin-top: 5px; margin-left: 10px; width: 70%;" value="2" />
<input id="Button9" type="button" value="删除" onclick="DelItem(this)" /> <input id="Button10" type="button" value="移至未解决" onclick="moveItem(this)" />
</div><div>
<input name="txtRsv" type="text" style="margin-top: 5px; margin-left: 10px; width: 70%;" value="3" />
<input id="Button11" type="button" value="删除" onclick="DelItem(this)" /> <input id="Button12" type="button" value="移至未解决" onclick="moveItem(this)" />
</div><div>
<input name="txtRsv" type="text" style="margin-top: 5px; margin-left: 10px; width: 70%;" value="4" />
<input id="Button13" type="button" value="删除" onclick="DelItem(this)" /> <input id="Button14" type="button" value="移至未解决" onclick="moveItem(this)" />
</div>
</div>
</div>
<br />
<div style="margin-top: 10px; margin-left: 60px;">
<a style="float: left">未解决:</a>
<div id="UnRsvDiv" style="margin-left: 50px; width: 960px;">
<div>
<input name="txtUnResv" type="text" style="margin-top: 5px; margin-left: 10px; width: 70%;" value="5" />
<input id="Button5" type="button" value="删除" onclick="DelItem(this)" /> <input id="Button6" type="button" value="移至已解决" onclick="moveItem(this,true)" />
</div><div>
<input name="txtUnResv" type="text" style="margin-top: 5px; margin-left: 10px; width: 70%;" value="6" />
<input id="Button2" type="button" value="删除" onclick="DelItem(this)" /> <input id="Button3" type="button" value="移至已解决" onclick="moveItem(this,true)" />
</div><div>
<input name="txtUnResv" type="text" style="margin-top: 5px; margin-left: 10px; width: 70%;" value="7" />
<input id="Button4" type="button" value="删除" onclick="DelItem(this)" /> <input id="Button8" type="button" value="移至已解决" onclick="moveItem(this,true)" />
</div>
</div>
</div>
</td>
</tr>
</table>
</body>
</html>