• Jquery判断其中任意一个文本框的值是否被修改


    <!doctype html>
    <html lang="en">
     <head>
      <meta charset="UTF-8">
      <meta name="Generator" content="EditPlus®">
      <meta name="Author" content="zzp">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <title>Document</title>
      <style type="text/css">   
        input:focus,textarea:focus{
           border:1px solid #f00;
           background:#fcc;
        
        }
        .focus{
           border:1px solid #f00;
            background:#fcc;
        }

       </style>
        <script type="text/javascript" src="js/jquery-1.6.4.min.js" ></script>
        <script type="text/javascript">
           var temp;
         $(function(){
               $(":input").focus(function(){   //获得焦点
                     alert(this.id);  
                     alert("获得焦点时的值是:"+$(this).val());  
                     temp=$.trim($(this).val());
                     alert(temp);
                    $(this).addClass("focus");   //添加样式

               }).blur(function(){ //失去焦点
                   $(this).removeClass("focus"); //移除样式
                   alert("失去焦点时的值是:"+$(this).val());  
                   var lastValue = $.trim($(this).val());  

                   if(temp != lastValue && null !=lastValue && "" !=lastValue)
                   {
                       alert("值改变了!");
                   }
                  
                   else{
                      alert("值没有变!");
                   }
                   /**     */    

               });
        
         });
        
        </script>


     </head>
     <body>
        <form action="#" method="post" id="reFrom">
          <fieldset>
             <legend>个人信息</legend>
             <div>
               <label>名称:</label>
               <input id="username" type="text" value="admin">
             </div>
             <div>
               <label>密码:</label>
               <input id="pass" type="text" value="123456">
             </div>
             <div>
               <label>性别:</label>
               <input id="sex" name="sex" type="radio" value="1" checked="checked">男
               <input id="sex" name="sex" type="radio" value="2">女
             </div>
              <div>
               <label>详细信息:</label>
               <input id="msg" type="text" value="获取值">
             </div>
          
          
          </fieldset>
        
        
        </form>
     </body>
    </html>

  • 相关阅读:
    oracle 自动备份
    oracle 常用操作语句
    数据库创建及使用注意事项
    oracle 导入 导出 备份
    http://blog.sina.com.cn/s/blog_5fc8b3810100iw9n.html
    利用普通工具编译的第一个Servlet
    对java:comp/env的研究(转)
    MyEclipse配置tomcat、jdk和发布第一个web项目
    构建 SSH 框架(转)
    Java Project和Web Project
  • 原文地址:https://www.cnblogs.com/zengzhanping/p/4353810.html
Copyright © 2020-2023  润新知