Return to Snippet

Revision: 11182
at January 27, 2009 10:04 by leonbda


Initial Code
function getQuerystring(key, default_)
{
  if (default_==null) default_="";
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
  else
    return qs[1];
}

Initial URL

                                

Initial Description
Get query string value via javaScript

Initial Title
Get query string via JavaScript

Initial Tags

                                

Initial Language
JavaScript