[Javascript] "Object Expected" Error

Andrew Dunn andrew at d2k.com.au
Thu May 2 18:32:25 CDT 2002


I normally get this error when the function you have calling does not exist
or you have misspelled the function. Your robot line may require that the ()
tags be up against the function call like: 'robot()' not 'robot ()'

-----Original Message-----
From: SoitPP at aol.com [mailto:SoitPP at aol.com] 
Sent: Friday, 3 May 2002 9:36 AM
To: javascript at LaTech.edu
Subject: [Javascript] "Object Expected" Error



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   
    

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list