Given a string containing an absolute URL with a querystring parameter, what is the easiest way to replace the value of the parameter using JavaScript and/or MooTools?
e.g.
// Change this
'/foo/bar?frob=123456789'
// Into this
'/foo/bar?frob=abcdefg'
EDIT
The URL is not the location of the current window. It is a variable containing a string. I just want to manipulate this string.
Sorry for bumping an old post but I think it’s already in mootools. No need to write it yourself 🙂 http://mootools.net/docs/more/Types/URI#URI:setData
Or take a look here if your on a very old version of mootools: http://pilon.nl/mootools/2009/02/05/extra-browsersextras/