Return to Snippet

Revision: 23698
at February 11, 2010 12:24 by derekholmes


Initial Code
function queryString(ji) 
{
    ji = ji.toLowerCase();
    hu = window.location.search.substring(1).toLowerCase();
    gy = hu.split("&");
    for (i=0;i<gy.length;i++) 
    {
        ft = gy[i].split("=");
        if (ft[0] == ji) 
            return ft[1];
    }
    return "";
}

Initial URL

                                

Initial Description
default.aspx?id=5
queryString('id') will return 5
Also this will convert to lower case. IIS / ASP.net is not case sensitive so my function isn't either.

Initial Title
Javascript QueryString

Initial Tags
javascript

Initial Language
JavaScript