'javascript' Tag

  • Feb
    18
    2009

    Be Careful parsing your URL string with Javascript

    …so I know you’ve looked around the net for a good method to parse URL variables with javascript, and I’m sure that you’ve found some elegant method that looks something like:
    function parseLocation() {
    var turl = window.location.search;
    ar = turl.split(’&’);
    var b = {};

    for (var i = 0; i < ar.length; i++) {
    var c = ar[i].split(’=');
    b[c[0]] = c[1];
    }
    return [...]

 
Powered by Wordpress and MySQL. Theme by openark.org