473,508 Members | 2,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4547
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
6706
by: Rubbrecht Philippe | last post by:
Hi there, According to documentation I read the ArrayList.IndexOf method uses the Object.Equals method to loop through the items in its list and locate the first index of an item that returns...
2
3293
by: Bernard Bourée | last post by:
I have a class named "Variable" with 2 properties "Name" and "Value" and the following class to handle a collection of Variable: Public Class ColVariables Inherits CollectionBase Default Public...
2
4202
by: kd | last post by:
Hi All, Consider the following code. Dim str As String Dim i As Integer str = " Hello Hi" If str.IndexOf("Abc Def") Or str.IndexOf("Ghi jkl mno") Or _ str.IndexOf("pqr stu vwxe") Or...
18
4705
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
11
12809
by: Al | last post by:
This statement returns a -1, indicating "not found": Find1 = Array.IndexOf(FilesArray, "sa001") But IndexOf on a specific item in that array returns a value of 26: Find1 =...
10
9633
by: JohnR | last post by:
I have an arraylist of string values. I would like to search the arraylist to find the index of a particular string and I would like the search to be case insensitive. dim al as new arraylist...
25
2576
by: Gordon Cowie | last post by:
Wouldn't it make sense if IndexOf just threw a character not found exception instead of -1? If -1 is what you were expecting there should be a function ContainsChar that returns bool. ...
1
8353
Atli
by: Atli | last post by:
The following small HowTo is a compilation of an original problem in getting some cookie-values through different methods of string-handling. The original Problem was posted as follows: As...
2
1559
by: Gozil | last post by:
Hello, i was wondering if its possible to check the my value against an array? Lets say I have 5 characters i dont want the user to have in the input field so instead of writeing like this: ...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5045
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.