469,609 Members | 2,043 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Another Error Object Expected ?

Hello all, I am new here and hope some kind, smarter than me person can help.
I am getting the error object expected with the following code:

Expand|Select|Wrap|Line Numbers
  1. function click(e); 
here the error says it expected '{' at Char:18

External js code for this is here:

Expand|Select|Wrap|Line Numbers
  1. function click(e) {
  2.     if (document.all) {
  3.         if (event.button == 2) {
  4.             alert(message);
  5.             return false;
  6.         }
  7.     }
  8.     if (document.layers) {
  9.         if (e.which == 3) {
  10.             alert(message);
  11.             return false;
  12.         }
  13.     }
  14. }
  15. if (document.layers) {
  16.     document.captureEvents(Event.MOUSEDOWN);
  17. }
  18. document.onmousedown=click;
Thank you for your help.
Julie
Oct 19 '07 #1
7 2146
gits
5,390 Expert Mod 4TB
hi ...

welcome to TSDN ...

i assume its the problem with your homepage? you mustn't write the following code, as you can see this is syntactically wrong:

[HTML]<script language="JavaScript" type="text/javascript">
<!--
function click(e);
-->
</script>[/HTML]
since:

Expand|Select|Wrap|Line Numbers
  1. document.onmousedown = click
already assigns the eventhandling during the external js includes parsing ... simply remove the useless statements

kind regards
Oct 19 '07 #2
thanks much for the fast reply.
I did what you said and that cleared up the one error, but I am still missing something.

I still get the object required error for line 43 which is blank so I would think that I still need something after

function click(e); (this is line 42)


I am very new to javascript.
Thanks
Julie
Oct 19 '07 #3
gits
5,390 Expert Mod 4TB
so i assume you have removed the following lines?

[HTML]<script language="JavaScript" type="text/javascript">
<!--
function click(e);
-->
</script>[/HTML]
kind regards
Oct 19 '07 #4
Yes, thanks to your wonderful help, I removed that and it still works fine without an error.

The very weird thing is I still get one error on line 43 which is blank. No code on it but IE7 still shows an error.
very strange.
thanks,
Julie
Oct 21 '07 #5
gits
5,390 Expert Mod 4TB
could you post the script that throws the error? because you have removed the lines ... so what is before and behind it?

kind regards
Oct 21 '07 #6
Hello,

I get this error on every page on my site. It is the only error.

Line: 43
Char: 11
Error: Object Expected
Code: )
URL: http://www.better-skin-care.com

Below is my code in Dreamweaver 8.


<body> is on line 40




<div id="header"> is on line 45
<!--======================== BEGIN COPYING THE HTML HERE ==========================-->
<img src="images/header22.png" alt="" name="header22" width="960" height="85" border="0" id="header22" />
<!--========================= STOP COPYING THE HTML HERE =========================-->
</div>

The line the error refers to is blank.
So I just don't know how to fix a blank line.

thanks again,
Julie
Oct 22 '07 #7
Try running it through another validator like the w3c.org site and see where they report your error. this might suggest a line that contains code.

--hm
Oct 22 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by lawrence | last post: by
9 posts views Thread by Thomas Christensen | last post: by
1 post views Thread by Franko | last post: by
1 post views Thread by Franko | last post: by
1 post views Thread by BSand0764 | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.