zoukankan      html  css  js  c++  java
  • js 读取URL参数

    var p = new ParamManager();

    p.GetValue('key');

            function ParamManager()
            {
                
    this.Location = window.location;
                
    this.ParamArray = new Array();
                
    this.onInit();
            }
            ParamManager.prototype.onInit
    =function(){
            
                
    var l = new String(this.Location);
                
    var paramstring = new String(l.substring(l.lastIndexOf('?')+1,l.length));
                
    this.ParamArray = paramstring.split('&');
                
    for(var i = 0;i<this.ParamArray.length;i++)
                {
                    
    this.ParamArray[i] = this.ParamArray[i].toString().split('=');
                }
           
            }
            ParamManager.prototype.GetValue
    =function(key){
               
    for(var i=0;i<this.ParamArray.length;i++)
               {
                    
    if(this.ParamArray[i][0== key)
                    {
                        
    return this.ParamArray[i][1];
                    }
               }
               
    return "null";
            }
  • 相关阅读:
    单例模式
    grails2.3.11第二课
    grails2.3.11第一课
    【安全】requests和BeautifulSoup小试牛刀
    【解决】国内访问github过慢
    基于Ubuntu14.10的Hadoop+HBase环境搭建
    基于adt-bundle的Android开发环境搭建
    【解决】SAE部署Django1.6+MySQL
    【解决】Django项目废弃SQLite3拥抱MySQL
    【OpenGL】画立方体
  • 原文地址:https://www.cnblogs.com/wubiyu/p/1277371.html
Copyright © 2011-2022 走看看