<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" />&nbsp;
                            <input id="Button1" type="button" value="删除" onclick="DelItem(this)" />&nbsp;<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" />&nbsp;
                            <input id="Button9" type="button" value="删除" onclick="DelItem(this)" />&nbsp;<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" />&nbsp;
                            <input id="Button11" type="button" value="删除" onclick="DelItem(this)" />&nbsp;<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" />&nbsp;
                            <input id="Button13" type="button" value="删除" onclick="DelItem(this)" />&nbsp;<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" />&nbsp; 
                            <input id="Button5" type="button" value="删除" onclick="DelItem(this)" />&nbsp;<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" />&nbsp; 
                            <input id="Button2" type="button" value="删除" onclick="DelItem(this)" />&nbsp;<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" />&nbsp; 
                            <input id="Button4" type="button" value="删除" onclick="DelItem(this)" />&nbsp;<input id="Button8" type="button" value="移至已解决" onclick="moveItem(this,true)" />
                       </div>
                        </div>
                    </div>
                </td>
        </tr>
    </table>
</body>
</html>

解决方案 »

  1.   

    大神,这个text位置移动的时候它的name能不能也帮忙改变一下
      

  2.   

            function moveItem(btn, ok) {
                var targetID = ok ? 'RsvDiv' : 'UnRsvDiv', item = btn.parentNode;
                document.getElementById(targetID).appendChild(item);
                btn.onclick = function () { moveItem(this, !ok); }
                btn.value = ok ? '移至未解决' : '移至已解决';
                var input = item.getElementsByTagName('input')[0];
                if (window.ActiveXObject) {//IE不能修改name,用outerHTML来弄
                    input.outerHTML = input.outerHTML.replace(ok ? 'txtUnResv' : 'txtRsv', ok ? 'txtRsv' : 'txtUnResv');
                }
                else input.name = ok ? 'txtRsv' : 'txtUnResv';
            }
      

  3.   

    大侠,求指导啊http://bbs.csdn.net/topics/390692810