[Javascript] "Object Expected" Error

SoitPP at aol.com SoitPP at aol.com
Thu May 2 18:35:46 CDT 2002


Dear JavaScript list,
I am getting an "Object Expected" Error when trying to 
call a certain function in a program. I don't quite understand 
what is causing this error. The program flow seems simple enough. 
What am I missing?
Here is a duplication of the error in a cut down version:



<html>
<head>
<title>Function Testing</title>
<script language="JavaScript"> 
function removeValue(string) {
if (string.indexOf("<TEXTAREA")) {
//line 17 follows
string = string.substring(0,indexOf("<TEXTAREA")) + 
string.substring(indexOf("</TEXTAREA>",string.length))
return string
}
return string
}
function robot() {
preSTRvariable = document.body.innerHTML
preSTRvariable = removeValue(preSTRvariable)
}
</script>
</head>
<body>
<form>
<button style="background-color: #FFFFFF" onClick="robot
()">Click</button>
</form>
</body>
</html>




Very simple right? So how come I get "Objected Expected" at line 17?
Patiently, 
Aaron   
    




More information about the Javascript mailing list