WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 Bug with argumenturl.js, McShane, February 1, 2001
     Re:Bug with argumenturl.js, Erik Arvidsson, February 2, 2001

Subject: Re:Bug with argumenturl.js From: Erik Arvidsson Date: February 2, 2001

You are so right... I'll fix it right away. Thanks.

There's actually more bugs in this one. First it should use escape and unescape for the names and values (you can see that faint effort of mine using replace). Secondly remove does not work correctly. The field should be deleted using the delete keyword.

I have a much nicer and shorter script that parses the script (if that's all you need):

document.location.arguments = (function (str) {
if (str.charAt(0) != '?') return {};
else str = str.substring(1, Infinity);
var result = {};
var parts = str.split("&");
for (var i = 0; i < parts.length; i++) {
var pair = parts[i].split("=");
result[unescape(pair[0])] = unescape(pair[1]);
return result;

And to use it just do (if the search string was "?hello=world"):


An alternative would be to add add and remove to the much more efficient code above...


From: McShane
Sent: Feburary 1, 2001
Subject: Re:Bug with argumenturl.js


In the _getArg function within ArgumentURL on http://webfx.eae.net/docs/argPassing/argsp2.html, you first check to see if the argument's type is "string" and then return null if it is not.  It seems to me that the argument's type will always be object and therefore _getArg will always return null, no?

Other than that, I have found the script to be extremely useful.  Thanks and keep up the good work!




Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.

View All Messages
Back to WebFX