在一个表格内,点击修改,会出现一个文本框,文本框的有原先的东西,修改文本框里的东西

解决方案 »

  1.   

    使用文本框显示,设置边框为0且readonly,点修改时再设置显示边框1且去掉readonly属性
      

  2.   

    文本框<input type=text>里的东西你不能用手动改,还需要用脚本改?
      

  3.   

    嗯、绑定表单的时候用<input type="textBox" readonly="true">点击修改调用你js的方法,根据你要修改的列、去把你想对应的文本框的readonly属性去掉、然后修改里面的内容。至于保存、你拿到这条数据的ID就可以了啊。
      

  4.   

    以前写过一个这样的 提供思路给你首先给td绑定单击事件  onclick="clickText(this)"在clickText 事件中,根据参数拿到 td里面原本的内容  不用jquery框架的话要用innerHTML然后生成一个text文本框,将td的内容赋值到文本框的value里给文本框绑定事件,具体是onblue 还是 onchange 这个你要根据自己的需要拿捏最后一步,在文本框的绑定事件里,将文本框的值替换到原本的td中 ,要先清空一下td里面的内容哈 
      

  5.   

    建议使用jquery吧!jquery操作html和表单非常方便!
    <input type="textbox" id="abc" ></input>
    $("#abc").va("值")
    别忘了引用jquery库上面本人的一些见解,有哪里不足的地方,请批评指正!
      

  6.   


    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="gb2312" />
    <title></title>
    <style>
    * {
    margin:0; padding:0; font-size:14px;
    }
    table {
    margin:100px;
    }
    td {
    width:200px; height:30px; line-height:30px;
    border:1px solid blue;
    }
    input {
    width:200px; height:30px; line-height:30px;
    border:0;
    }
    </style>
    </head>
    <body>
    <table>
    <tr>
    <td><input value="1-1" /></td>
    <td><input value="1-2" /></td>
    </tr>
    <tr>
    <td><input value="2-1" /></td>
    <td><input value="2-2" /></td>
    </tr>
    </table>
    <script>
    function $(el){
    return typeof el == 'string' ? document.getElementById(el) : el;
    }
    function $t(name, cot){
    cot = cot || document;
    return cot.getElementsByTagName(name);
    }
    var arr = $t('input');
    for(var i = 0, len = arr.length; i < len; i++){
    arr[i].onfocus = function(){
    this.style.border = '1px solid red';
    this.parentNode.style.border = '0';
    }
    arr[i].onblur = function(){
    this.style.border = 'none';
    this.parentNode.style.border = '1px solid blue';
    }
    }
    </script>
    </body>
    </html>