zoukankan      html  css  js  c++  java
  • javascript prototype

    String.prototype.trim = function() {  
        return this.replace(/^s+|s+$/g,"");  
    }  
    String.prototype.ltrim = function() {  
        return this.replace(/^s+/,"");  
    }  
    String.prototype.rtrim = function() {  
        return this.replace(/s+$/,"");  
    }  

    Prototype.js中bind方法的源码
    Function.prototype.bind = function(){
      var fn = this, args = Array.prototype.slice.call(arguments), object = args.shift();
      return function(){
        return fn.apply(object,
          args.concat(Array.prototype.slice.call(arguments)));
      };
    };
    

    AJAX前进后退按钮失效,及刷新问题的解决方案

    function hashChange(){
        var m=window.location.hash.split('#');
        m=m[1]?m[1].split('=')[1]:0;//获取到锚点的参数值
        if(m){
            $.post(App_path,{type:type},function(){//将锚点参数提交到后台处理,返回所需信息
                //do some thing here
            })
        }
    }
    $(window).hashchange(function(){
        hashChange();
    })
    
  • 相关阅读:
    IE11浏览器:请不要再叫我IE,谢谢
    Hadoop HA高可用搭建流程
    YARN
    MapReduce
    HDFS
    shell
    shell总结
    linux总结
    maven+log4j
    Spring
  • 原文地址:https://www.cnblogs.com/sntetwt/p/4054291.html
Copyright © 2011-2022 走看看