• jQuery学习备忘


    1.标准的ajax提交:

    /**
     * @param {Object} data_
     * @param {Object} url_
     */
    function getParamsSvnPathAndFileName(data_,url_){
    	var pathAndFileObj = {}
    	$.ajax({
    		url:url_,dataType:"json",type:"POST",async:false,data:data_,
    		success:function(data){
    			if(data){ pathAndFileObj = data; }
    	  	}
    	});
    	return pathAndFileObj;
    }
    

    2.批量添加/删除属性:

    $(function(){
      $("#content").find("span").each(function(){
        $(this).attr("title",$(this).text());
        $(this).removeAttr("title");
      });
    });
    

    3.添加自动汉语提示功能

     1 $(".sch input.txt").each(function(){
     2         if(this.value=="")
     3         {    
     4             this.value="自动提示";
     5             this.style.color="#ccc";
     6         }
     7         this.initValue = this.value;
     8         $(this).click(function(){ 
     9             if((this.value == this.initValue)){ 
    10                 this.value='';this.style.color='#000';
    11             }
    12         }).blur(function(){
    13             if(this.value == '' || (this.value == this.initValue)){
    14                 this.value=this.initValue;
    15                 this.style.color='#ccc'; 
    16             }else{
    17                 this.style.color='#000';
    18             }});
    19     });
    自动提示

     4.选择查找

     1 $(".tabs .tab li:eq(0)").click(function(){
     2                            $(".tabs .tab li").removeClass("current");
     3                            $(this).addClass("current");
     4                            $("#page_content1").hide();
     5                            
     6                            $("#page_content").show();
     7                            
     8                            
     9                            $("#page_content").find(".easyui-datagrid").datagrid("resize",{800,height:470});
    10                            
    11             });
    12 
    13 
    14 $("#tabs li:eq(0)").click();
    选择查找

    5.动态修改各个属性

    1 jQuery("#ifmTab").attr({height:'100%','100%',frameborder:'0',scrolling:'no',allowtransparency:'true',style:''});
    attr
  • 相关阅读:
    hdu2060
    hdu1003
    style属性
    变量与常量
    使用BIgDecimal进行浮点数的精确计算
    CSUST 玩游戏 题解(思维+优先队列维护第k大)
    百度之星 迷失 题解(矩阵快速幂+分层图)
    CSUST 简单数学题 题解(质因子分解+并查集)
    CSUST 神秘群岛 题解(LCA)
    CSUST lh的简单图论 题解(图转树LCA问题)
  • 原文地址:https://www.cnblogs.com/duffy/p/3940079.html
Copyright © 2020-2023  润新知