views:

2182

answers:

3

I am using the functions strpos(string, string) in javascript. In Firefox, Opera and IE the page loads fine, but in Chrome I get the error: Uncaught ReferenceError: strpos is not defined. The page I am working on is http://seniorproject.korykirk.com/0xpi2.php

+5  A: 

Use haystack.indexOf(needle).

Artelius
+4  A: 

strpos is not part of the ECMAScript Language Specification ECMA-262 3rd edition (commonly known as javascript)

Like Artelius wrote, use haystack.indexOf(needle,start) or haystack.lastIndexOf(needle,start) (where start is optional)

some
A: 

If you want to use PHP functions in javascript, use php.js

Here's strpos() http://phpjs.org/functions/strpos:545

TRiG