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>

  • 相关阅读:
    【翻译】让你的网站飞起来
    理解ASP.NET MVC中的模型绑定
    【转载】创建定制ASP.NET MVC视图引擎
    修改STM32主频
    Cortex系列ARM核心及体系结构介绍
    递归
    NFD模拟兴趣包的转发
    NX 笔记
    MicroPython 8266 配置
    Python JSON操作
  • 原文地址:https://www.cnblogs.com/xiayahui/p/5013614.html
Copyright © 2011-2022 走看看