Wednesday, July 23, 2014

Javascript Function To Get Querystring Value

function getQueryStringValue(paramName) {
    try {
        var params = document.URLUnencoded.split("?")[1].split("&");
        var strParams = "";
        for (var i = 0; i < params.length; i = i + 1) {
            var singleParam = params[i].split("=");
            if (singleParam[0] == paramName)
                return decodeURIComponent(singleParam[1]);
        }
    }
    catch (err)
    { return null; }
}


var id = getQueryStringValue("Id");  

No comments:

Post a Comment