填写值然后点击确定,值被赋到文本框中,点击修改可以改写文本框中的值
按钮默认为确定,填写值之后变为修改
请老鸟们帮帮我

解决方案 »

  1.   

    <html>
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <head>
    <script language=javascript>
    function change(){
       var btn = document.getElementById('btn1');
       var tx2 = document.getElementById('tx2');
       var tx1 = document.getElementById('tx1');
       if(btn.value == '确定'){
          tx2.value = tx1.value;
          tx1.style.display = 'none';
          tx2.style.display = '';
          btn.value = '修改'
       }else{
          tx1.style.display = '';
          tx2.style.display = 'none';
          btn.value = '确定'
       }
    }
    </script>
    </head>
    <body>
    <table>
    <tr>
    <td>
    <input type="text" id="tx1">
    <input type="text" id="tx2" style="display: none" disabled="disabled">
    </td>
    <td>
    <input type="button" id="btn1" value="确定" onclick="change()">
    </td>
    </tr>

    </table>
    </body>
    </html>