Return to Snippet

Revision: 5102
at February 11, 2008 17:45 by iTony

Initial Code
function gup( name )
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
    return results[1];

Initial URL

Initial Description
This makes it easy to retrieve certain value from a url with different values appended to it.

Initial Title
retrieve values from a url

Initial Tags
regex, url, javascript

Initial Language