zoukankan      html  css  js  c++  java
  • 表单类 文本框失去焦点jquery

    表单类失去焦点的效果
    
    <script type="text/javascript">
    
    
    	$(function(){
    		$(":input").focus(function(){	//此处可获取各种表单如(:text/:button)
    			$(this).addClass("focusa");	
    			if ($(this).val()==this.defaultValue){	
    				$(this).val("");
    				}
    			}).blur(function(){	
    			$(this).removeClass("focusa");						
    			if ($(this).val()==""){				
    				$(this).val(this.defaultValue);								
    				}				
    				});		
    		});
    </script>



    各种表单的类型:


    <input type="text" /> 文本框 
    <input type="password" /> 密码框 
    <input type="submit" /> 提交按钮 
    <input type="reset" /> 重置按钮 
    <input type="radio" /> 单选框 
    <input type="checkbox" /> 复选框 
    <input type="button" /> 普通按钮 
    <input type="file" /> 文件选择控件 
    <input type="hidden" /> 隐藏框 
    <input type="image" /> 图片按钮 


  • 相关阅读:
    作业01
    C语言I博客作业08
    C语言I博客作业07
    C语言I博客作业06
    C语言I博客作业05
    C语言I博客作业04
    C语言II博客作业04
    C语言II—作业03
    C语言II博客作业02
    C语言II博客作业01
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/3043235.html
Copyright © 2011-2022 走看看