View previous topic :: View next topic |
Author |
Message |
phil karras
Senior Member

Joined: 15 Jul 2002
Posts: 1697
Location: MD
|
Posted: Tue Jul 16, 2002 6:48 am Post subject: Object Expected Error |
 |
|
Someone I was helping had the following error pop up on some browsers:
line ##
char 1
object expected
It turned out to be caused by a line like this:
Code: |
<body gcolor="#BA8F3F" onLoad="My_preloadImages('image1.gif','image2.gif')">
|
This is because the function: My_preloadImages was not defined in this html file and was not loaded by a
<script language="JavaScript" src="MyFunctions.js">
type line either.
Once I made a dummy function of that name and placed it in the header section all was well, except of course that the images wanted were not in fact pre-loaded.
This Error Means:
(1) that for some reason a function expected has not been found. It could be that you mis-typed the name MyFunction is different from the following: myFunction, Myfunction, & myfunction to name but a few.
(2) It could be that the function was loaded but too late. Using something like:
Code: |
<script ....>
var = MyFunction();
</script>
.
.
.
<script ..... src='MyLib.js'>
// Holds all my functions including MyFunction()
</script>
|
would cause this problem.
(3) An error occured before the function could be loaded which caused the rest of the script to abort. In some very strange cases this error might not be seen by you if the browser for some reason doesn't choke on it, yet all code following this error will NOT HAVE BEEN LOADED! - This has got to be the most difficult to locate, but I'd suggest that if everything looks OK to you, then simply move this function to the beginning of the <script> section and see what happens. By moving each piece from the bottom to the top (one piece at a time) you will eventually be able to locate the defective section.
_________________
Phil K
Circle Software Consulting
Test website: http://cs.yrex.com/
Guidelines for Posting: http://jsworkshop.com/posting.html
IHBAAA = It Has Been Asked And Answered
KISS: http://jsworkshop.com/bb/viewtopic.php?t=508
|
|
Back to top |
|
 |
phil karras
Senior Member

Joined: 15 Jul 2002
Posts: 1697
Location: MD
|
|
Back to top |
|
 |
redmuff
New member

Joined: 14 Apr 2005
Posts: 1
|
Posted: Thu Apr 14, 2005 8:14 am Post subject: |
 |
|
dude, I fixed this it was really wierd, never seen it before
the browser wasnt accepting the following function template
function doSomething()
{
//do something here
}
it would only accept
function doSomething(){
//do something here
}
notice the difference? the '{' tag had to be on the same line as the function declaration.
This happened when I was doing it as part of an xsl transformation, but I doubt that had anything to do with it. |
|
Back to top |
|
 |
phil karras
Senior Member

Joined: 15 Jul 2002
Posts: 1697
Location: MD
|
|
Back to top |
|
 |
|