Reputation: 6770
OK,
Here is my problem, I have a master page with a HEAD section that contains my JS includes. I have one JS include
<script src="Includes/js/browser.js" language="javascript" type="text/javascript"></script>
In my page i consume it like this:
<body>
<form id="form1" runat="server">
<div>
....
<script type="text/javascript">registerBookmarkButton();</script>
....
</div>
</form>
</body>
And i get this error:
Line: 216
Error: Object expected
Please tell me i just missed something and it's a stupid mistake
Upvotes: 1
Views: 649
Reputation: 5176
check if youre using a keyword as an identifier in yoru code
http://mattsnider.com/languages/javascript/reserved-words-in-javascript/
http://bytes.com/groups/javascript/424640-error-object-expected
http://msdn.microsoft.com/en-us/library/0779sbks.aspx
Upvotes: -1
Reputation: 140050
alert()
calls here and there to narrow down the error to a particular location.Upvotes: 1
Reputation: 76709
The "Object expected" error occurs when the browser's script engine was expecting to find an object, but was unable to do so. This usually occurs when you try to make a function call, but the function itself is unavailable to the script engine, presumably because you mistyped the function name when calling it.
To successfully debug this error, you must first determine the instruction at the line number reported in the error. This cannot be done by browsing through all the source files, unless you have some psychic debugging powers. It is recommended that the exception be caught inside a JavaScript debugger. If you are debugging this under MS IE, you might want to install Microsoft Script Engine which can be installed with MS Office, or the poor man's Microsoft Script Debugger. For Firefox, there are the excellent Firebug and Venkman extensions. Jonathan Boutelle's blog post on debugging JavaScript in IE seems like a must read.
Upvotes: 0
Reputation: 30990
If you can use Firefox, I would highly recommend installing and enabling the Firebug addon.
Otherwise, see some of the following for tools that might help:
Upvotes: 2
Reputation: 106920
As you wish.
You just missed something and it's a stupid mistake.
:)
That being said, I'd try to find out which file it is that has the faulty line 216. Perhaps it's the browser.js file? Other possibilities include:
Upvotes: 2