Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 35
  1. #1
    Regular Coder enderwiggin7's Avatar
    Join Date
    Jun 2009
    Posts
    131
    Thanks
    22
    Thanked 0 Times in 0 Posts

    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?

  • #2
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    I think the separator between the parameters passed inside the function should b "," and not ";"

  • #3
    Regular Coder enderwiggin7's Avatar
    Join Date
    Jun 2009
    Posts
    131
    Thanks
    22
    Thanked 0 Times in 0 Posts
    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.


  • #4
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    Post code please to take a deeper look.

  • #5
    Regular Coder enderwiggin7's Avatar
    Join Date
    Jun 2009
    Posts
    131
    Thanks
    22
    Thanked 0 Times in 0 Posts

  • #6
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,478
    Thanks
    6
    Thanked 981 Times in 954 Posts
    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?

  • #7
    Regular Coder enderwiggin7's Avatar
    Join Date
    Jun 2009
    Posts
    131
    Thanks
    22
    Thanked 0 Times in 0 Posts
    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.

  • #8
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    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.

  • #9
    Regular Coder enderwiggin7's Avatar
    Join Date
    Jun 2009
    Posts
    131
    Thanks
    22
    Thanked 0 Times in 0 Posts
    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.

  • #10
    Regular Coder enderwiggin7's Avatar
    Join Date
    Jun 2009
    Posts
    131
    Thanks
    22
    Thanked 0 Times in 0 Posts
    Update: the semicolons were replaced with commas, and uploaded to the site, and now my navbar has disappeared entirely. o.O

  • #11
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Use Firefox with Firebug. Quickly identifies javascript errors. Assuming your site is at http://www.bebetterdomore.com/, you have these errors:
    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?

  • #12
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    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?

  • Users who have thanked tomws for this post:

    enderwiggin7 (07-16-2009)

  • #13
    Regular Coder enderwiggin7's Avatar
    Join Date
    Jun 2009
    Posts
    131
    Thanks
    22
    Thanked 0 Times in 0 Posts
    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?

  • #14
    Regular Coder enderwiggin7's Avatar
    Join Date
    Jun 2009
    Posts
    131
    Thanks
    22
    Thanked 0 Times in 0 Posts
    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!

  • #15
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    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?


  •  
    Page 1 of 3 123 LastLast

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •