By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,287 Members | 1,668 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

indexOf

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.