Gossamer Forum
Home : General : Internet Technologies :

Javascript question about "indexOf()" function!

Quote Reply
Javascript question about "indexOf()" function!
Hello !

I have a simple Javascript code like this

Code:


<script language=javascript>

var data ="Honda/Toyota/Lexus/MBez/Ford";

var check ="Honda";

if (data.indexOf(check) ==-1) {

return true;

}

else{

alert(check + " was used");

return false;

}

</script>


The problem is : If I set var check ="Hon"; I still get the Message Alert "Hon was used" (Honda was used - not Hon)

Can you please help me to solve this sistuation !

Thanks

N.A


Subject Author Views Date
Thread Javascript question about "indexOf()" function! newage24 5366 Oct 14, 2002, 1:05 AM
Post Re: [newage24] Javascript question about "indexOf()" function!
Paul 5114 Oct 14, 2002, 2:21 AM
Post Re: [newage24] Javascript question about "indexOf()" function!
cornball 5099 Oct 15, 2002, 8:42 AM
Post Re: [newage24] Javascript question about "indexOf()" function!
cornball 5105 Oct 15, 2002, 10:08 AM