zoukankan      html  css  js  c++  java
  • javaScript实现修改输入框之后标红

    <html>
     <title>实现标红</title>
     <script type="text/javascript">
      function edit_save(value1){
        for(var i=1;i<4;i++){
         if(value1==1)
           document.getElementById('input'+i).disabled="";
         else
           document.getElementById('input'+i).disabled="none";
        }
       } 
       function blurTest(inputTag,value1){
        var newValue = document.getElementById(inputTag).value;
        if(value1!=newValue){
          document.getElementById(inputTag).style.color = '#ff0000';
         }else{
          document.getElementById(inputTag).style.color = '#000000';
         }
       }
     </script>
     <body>
      <table border='0' width = "800" align="center">
       <tr>
        <td><input id="input1" type="text" value="A" disabled="true" onblur="blurTest('input1','A')" ></input><td>
        <td><input id="input2" type="text" value="B" disabled="true" onblur="blurTest('input2','B')" ></input><td>
        <td><input id="input3" type="text" value="C" disabled="true" onblur="blurTest('input3','C')" ></input><td>
        <td><input type="button" onclick="edit_save('1')" value="编辑"></td>
         <td><input type="button" onclick="edit_save('2')" value="保存"></td>
       </tr>
      <table>
     </body>
    </html>

  • 相关阅读:
    程序从命令行接收多个数字,求和之后输出结果。
    动态规划(1)
    软件工程个人作业(4)
    冲刺2 01
    构建之法
    水王
    大道至简第七章读后感
    构建之法03
    团队冲刺第四天
    团队冲刺第三天
  • 原文地址:https://www.cnblogs.com/xiayahui/p/5013614.html
Copyright © 2011-2022 走看看