日期:2014-05-16  浏览次数:20393 次

点"编辑"后该行的内容都变成在编辑框里面 这个功能怎么实现?
<tr>
        <td> 11 </td>
        <td> <a   href=http://www.csdn.net "> CSDN </a> </td>
        <td> <a   href= "javascript:edit() "> 编辑 </a> </td>
</tr>

这是一个列表的其中一行   第一个td里面的 "11 "是动态读取出来的   每行都不一样
我想在点击 "编辑 "以后   该行变成可以编辑的状态


<tr>
        <td> <input   name= "uid "   type= "text "   id= "uid "   size= "5 "   maxlength= "255 "   value= "11 "/> </td>
        <td> <input   name= "editname "   type= "text "   id= "editname "   size= "30 "   maxlength= "45 "   value= "CSDN "/> </td>
        <td> <input   name= "urledit "   type= "text "   id= "urledit "   value= "http://www.csdn.net "   size= "60 "   maxlength= "255 "   /> <input   type= "submit "   name= "Submit "   value= "提交 "   /> </td>
</tr>

这个js怎么写?还有   这个是需要提交后用程序处理的   这个 <form   name= "fedit "   method= "post "   action= "plugin.php?paction=edit "> 放在什么地方?谢谢



------解决方案--------------------
<table>
<tr>
<td id= "td1 "> 11 </td>
<td> <a href=http://www.csdn.net "> CSDN </a> </td>
<td> <a href= "javascript:edit() "> 编辑 </a> </td>
</tr>
</table>
<script language= "javascript ">
function edit()
{
var cell = document.getElementById( 'td1 ');
var v = cell.innerHTML;
cell.innerHTML = ' <input type= "text " name= "text1 " id= "text1 "> ';
document.getElementById( 'text1 ').value = v;
}
</script>

///////////////////////////////

<form name= "fedit " method= "post " action= "plugin.php?paction=edit ">
<table>
<tr>
<td>
<input name= "uid " type= "text " id= "uid " size= "5 " maxlength= "255 " value= "11 "/>
</td>
<td>
<input name= "editname " type= "text " id= "editname " size= "30 " maxlength= "45 " value= "CSDN "/>
</td>
<td>
<input name= "urledit " type= "text " id= "urledit " value= "http://www.csdn.net " size= "60 " maxlength= "255 " />
<input type= "submit " name= "Submit " value= "提交 " />
</td>
</tr>
</table>
</form>

------解决方案--------------------
<tr>
<td id= "tdID "> 11 </td> //设置该单元格的第id为tdID
<td> <a href=http://www.csdn.net "> CSDN </a> </td>
<td> <a href= "javascript:edit() "> 编辑 </a> </td>
</tr>