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>

原文地址:https://www.cnblogs.com/xiayahui/p/5013614.html