Javascript String getParameter(t)

Description

Javascript String getParameter(t)

String.prototype.getParameter = function(t) {
    'use strict';
    t = t.toString();//from  w  ww.j a  v a 2  s . co  m
    var pairs = this.split('&');
    for (var i = 0; i < pairs.length; i++) {
        var keyValue = pairs[i].split('=');
        if (decodeURI(keyValue[0]) === t) {
            return decodeURI(keyValue[1]);
        }
    }
    return undefined;
};



PreviousNext

Related