470,648 Members | 1,640 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

indexOf

i am getting the error "indexOf is not a function" when calling
URi.indexOf('?')

the code:

function removeFromURL(URi, parameter)

{
var regexp, path, params, qStart = URi.indexOf('?') + 1;
if (qStart == 0 || qStart == URi.length-1) return URi;
regexp = new RegExp("(" + parameter + "=[^&]+(&)?)");
return URi.substring(0,qStart) +
URi.substring(qStart).replace(regexp,'').replace(/&$/,'');
}

Thanks a lot Dennis

Aug 8 '05 #1
2 4410
d.********@gmx.net schrieb:
i am getting the error "indexOf is not a function" when calling
URi.indexOf('?')

the code:

function removeFromURL(URi, parameter)

{
var regexp, path, params, qStart = URi.indexOf('?') + 1;
if (qStart == 0 || qStart == URi.length-1) return URi;
regexp = new RegExp("(" + parameter + "=[^&]+(&)?)");
return URi.substring(0,qStart) +
URi.substring(qStart).replace(regexp,'').replace(/&$/,'');
}

Thanks a lot Dennis


How are you calling the function? Tested with IE6 and Firefox 1.0.4 withou problems.
Aug 8 '05 #2
Ivo
<d.********@gmx.net> wrote
i am getting the error "indexOf is not a function" when calling
URi.indexOf('?')

function removeFromURL(URi, parameter)
{
var regexp, path, params, qStart = URi.indexOf('?') + 1;


You don't say what URi is or should be, so we can only guess. Have you
actually checked that what is passed to the function is a string, as you
expect it to be, by the looks of it? Do put an alert( typeof URi ) just
before the call to indexOf and see.

hth
ivo
Aug 8 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bernard Bourée | last post: by
2 posts views Thread by kd | last post: by
11 posts views Thread by Al | last post: by
25 posts views Thread by Gordon Cowie | last post: by
2 posts views Thread by Gozil | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.