i am using HTML5 and indexOf gives me an error, so what else can i use to search for the word “correct” in a string: a001_new_quiz_multiple_choice_new_mc4_correct.html which is in a variable called value1
function SetAPIValue(key1, value1)
{
// alert("action is " + key1 + " and data is " + value1);
console.log(value1);
var str = "wrong";
var n = str.search(value1);
if (n > 0)
alert("found");
}
the error i get: 0x800a01b6 – Microsoft JScript runtime error: Object doesn’t support property or method ‘indexOf’
I don’t know how you used indexOf, but this works :
Maybe you tried
"correct".indexOf(value1);instead ofvalue1.indexOf("correct");?demonstration