JavaScript Get function
Blog friend Ben shared a nice JavaScript Get function. As the name says, it returns the wanted Get variable.
// Author: Benjamin Carlier, http://benjamincarlier.be/var uri={get:function(id){return unescape(location.search.match('(?:\\?|\&)' + id + '=([^\&]*)')[1].replace(/\+/g, " "))}}To use it, only var term = uri.get('q'); is needed to put the search terms in the variable term.
Posted on Thursday, April 5th, 2007 in JavaScript
Comments and trackbacks are welcome.
