473,662 Members | 2,631 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(U Ri, 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(q Start).replace( regexp,'').repl ace(/&$/,'');
}

Thanks a lot Dennis

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

the code:

function removeFromURL(U Ri, 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(q Start).replace( regexp,'').repl ace(/&$/,'');
}

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(U Ri, 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
6730
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 True. Therefore, overriding the Equals method in the class definition of the items I put in the ArrayList should make the IndexOf method use my version of the Equals method?!
2
3304
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 Property Item(ByVal index As Integer) As Variable Get Return CType(List(index), Variable) End Get Set(ByVal Value As Variable)
2
4217
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 str.IndexOf("errr erttt. tttt") Or _
18
4730
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 class where only the "searched" property has a value. I expected to get the index into the arraylist where I could then get the entire class instance. However, the 'indexof' is never calling my overloaded, overrides Equals method. Here is the...
11
12847
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 = FilesArray(2).IndexOf("sa001") This shows the value "sa001" is found in FilesArray. Any suggestions why Array.IndexOf does not return a number (index of item that has the value)?
10
9678
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 al.add("one") al.add("two") dim x as integer = al.indexof("ONE") I would like this to find the match and return 0
25
2588
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. Thoughts?
1
8365
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 you can see, there could have been a problem with the split-method. The following short article handles ways around this possible problem, that we couldn't reproduce, but someone may possibly encounter it too sometimes. If nothing else, the shown...
2
1571
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: my_value.indexOf('first') == -1 my_value.indexOf('second') == -1 my_value.indexOf('3rd') == -1 my_value.indexOf('4th') == -1 my_value.indexOf('5th') == -1 and so on... I would write like this:
0
8435
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.