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";
            }
  • 相关阅读:
    案例7-1.2 插入排序还是归并排序 (25分)
    自动化运维工具——puppet详解(一)
    centos6.8的安装和配置
    ZooKeeper内部原理
    ZooKeeper安装和配置
    zookeeper入门
    shell中uniq与sort -u 两种去重的对别
    tomcat日志文件 访问IP统计
    Mysql常用命令
    linux一键安装php脚本
  • 原文地址:https://www.cnblogs.com/wubiyu/p/1277371.html
Copyright © 2011-2022 走看看