Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-16-2009, 07:13 PM   PM User | #1
enderwiggin7
Regular Coder

 
enderwiggin7's Avatar
 
Join Date: Jun 2009
Posts: 131
Thanks: 22
Thanked 0 Times in 0 Posts
enderwiggin7 is an unknown quantity at this point
Unkown Javascript error

Code:
addMainItem('index.html';'::Home';mwidth;'center';'';'';0;0;'');
The above line of code in my navbar is crapping at me for having bad syntax, something about lacking a closing brace. Clearly, I have a closing brace. Any ideas?
enderwiggin7 is offline   Reply With Quote
Old 07-16-2009, 07:17 PM   PM User | #2
ckeyrouz
Senior Coder

 
ckeyrouz's Avatar
 
Join Date: Jun 2009
Location: Montreal, Canada
Posts: 1,044
Thanks: 5
Thanked 179 Times in 179 Posts
ckeyrouz is on a distinguished road
I think the separator between the parameters passed inside the function should b "," and not ";"
ckeyrouz is offline   Reply With Quote
Old 07-16-2009, 07:41 PM   PM User | #3
enderwiggin7
Regular Coder

 
enderwiggin7's Avatar
 
Join Date: Jun 2009
Posts: 131
Thanks: 22
Thanked 0 Times in 0 Posts
enderwiggin7 is an unknown quantity at this point
See, that's what I thought - but then I was checking out help sites, and they said use ";"

...and that still doesn't explain the ")" error.

enderwiggin7 is offline   Reply With Quote
Old 07-16-2009, 07:46 PM   PM User | #4
ckeyrouz
Senior Coder

 
ckeyrouz's Avatar
 
Join Date: Jun 2009
Location: Montreal, Canada
Posts: 1,044
Thanks: 5
Thanked 179 Times in 179 Posts
ckeyrouz is on a distinguished road
Post code please to take a deeper look.
ckeyrouz is offline   Reply With Quote
Old 07-16-2009, 07:48 PM   PM User | #5
enderwiggin7
Regular Coder

 
enderwiggin7's Avatar
 
Join Date: Jun 2009
Posts: 131
Thanks: 22
Thanked 0 Times in 0 Posts
enderwiggin7 is an unknown quantity at this point
www.bebetterdomore.com/custom.js

line 121
enderwiggin7 is offline   Reply With Quote
Old 07-16-2009, 07:48 PM   PM User | #6
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,696
Thanks: 5
Thanked 875 Times in 850 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Quote:
Originally Posted by enderwiggin7 View Post
See, that's what I thought - but then I was checking out help sites, and they said use ";"

...and that still doesn't explain the ")" error.

Really, this can’t be semicolons, it must be commas. What are these help sites that tell you this?
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 07-16-2009, 07:57 PM   PM User | #7
enderwiggin7
Regular Coder

 
enderwiggin7's Avatar
 
Join Date: Jun 2009
Posts: 131
Thanks: 22
Thanked 0 Times in 0 Posts
enderwiggin7 is an unknown quantity at this point
I closed the other link, but here is one of them. I could have misread it - I'm still pretty new to Javascript... programming in general, really.

I haven't had a chance to implement your CSS bar just yet - I will be very soon. The current Javascript bar seems to be working fine now on most computers, just not a few. The error seems to focus on that one line, which is the only section that doesn't load properly.
enderwiggin7 is offline   Reply With Quote
Old 07-16-2009, 07:57 PM   PM User | #8
ckeyrouz
Senior Coder

 
ckeyrouz's Avatar
 
Join Date: Jun 2009
Location: Montreal, Canada
Posts: 1,044
Thanks: 5
Thanked 179 Times in 179 Posts
ckeyrouz is on a distinguished road
I saw in the site you have mentioned:
addMainItem("index.html","::Home",mwidth,"center","","",0,0,"");

so there are no ; only ,

My question is are you sure you did not miss any import of a js file where the method addMainItem is defined?

Otherwise post your code not the code of the web site you got your source from.
ckeyrouz is offline   Reply With Quote
Old 07-16-2009, 08:00 PM   PM User | #9
enderwiggin7
Regular Coder

 
enderwiggin7's Avatar
 
Join Date: Jun 2009
Posts: 131
Thanks: 22
Thanked 0 Times in 0 Posts
enderwiggin7 is an unknown quantity at this point
Quote:
My question is are you sure you did not miss any import of a js file where the method addMainItem is defined?
Um, not really sure what you mean by this, sorry.

I never uploaded the code with semicolons to the site, but the rest of the code is the same. Now that VIPStephan assures me that they shouldn't be there, I won't be.
enderwiggin7 is offline   Reply With Quote
Old 07-16-2009, 08:02 PM   PM User | #10
enderwiggin7
Regular Coder

 
enderwiggin7's Avatar
 
Join Date: Jun 2009
Posts: 131
Thanks: 22
Thanked 0 Times in 0 Posts
enderwiggin7 is an unknown quantity at this point
Update: the semicolons were replaced with commas, and uploaded to the site, and now my navbar has disappeared entirely. o.O
enderwiggin7 is offline   Reply With Quote
Old 07-16-2009, 08:14 PM   PM User | #11
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
Use Firefox with Firebug. Quickly identifies javascript errors. Assuming your site is at http://www.bebetterdomore.com/, you have these errors:
Quote:
missing variable name
http://www.bebetterdomore.com/custom.js
Line 29

bSIZE is not defined
http://www.bebetterdomore.com/style.js
Line 12

baseHREF is not defined
http://www.bebetterdomore.com/menu.js
Line 4
__________________
Are you a Help Vampire?
tomws is offline   Reply With Quote
Old 07-16-2009, 08:16 PM   PM User | #12
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
Now that I look at the code, I see the problem. VIPStephan didn't say to replace ALL semicolons on your site with commas. Use commas in function calls to separate the arguments. Use semicolons as line terminators.
__________________
Are you a Help Vampire?
tomws is offline   Reply With Quote
Users who have thanked tomws for this post:
enderwiggin7 (07-16-2009)
Old 07-16-2009, 08:18 PM   PM User | #13
enderwiggin7
Regular Coder

 
enderwiggin7's Avatar
 
Join Date: Jun 2009
Posts: 131
Thanks: 22
Thanked 0 Times in 0 Posts
enderwiggin7 is an unknown quantity at this point
I have FireBug - how do I use it to view Javascript errors? I can only see HTML.

Also, how do I define those two variables? Could they be causing the error that causes my nabar to work sometimes but not others?
enderwiggin7 is offline   Reply With Quote
Old 07-16-2009, 08:19 PM   PM User | #14
enderwiggin7
Regular Coder

 
enderwiggin7's Avatar
 
Join Date: Jun 2009
Posts: 131
Thanks: 22
Thanked 0 Times in 0 Posts
enderwiggin7 is an unknown quantity at this point
Quote:
Originally Posted by tomws View Post
Now that I look at the code, I see the problem. VIPStephan didn't say to replace ALL semicolons on your site with commas. Use commas in function calls to separate the arguments. Use semicolons as line terminators.
Aha! Okay, I'll go and convert those now. Thank you!
enderwiggin7 is offline   Reply With Quote
Old 07-16-2009, 08:25 PM   PM User | #15
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
Quote:
Originally Posted by enderwiggin7 View Post
I have FireBug - how do I use it to view Javascript errors? I can only see HTML.
Open the Firebug panel. Click on something like the Script tab. You should see text similar to "XYZ panel is disabled." Click all of the checkboxes and click the Apply Settings button. Welcome to a whole new world of debugging. Celebrate with pizza.
__________________
Are you a Help Vampire?
tomws is offline   Reply With Quote
Reply

Bookmarks

Tags
error, javascript, navbar, syntax

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:39 AM.


Advertisement
Log in to turn off these ads.