syntax errors; how to find

Discussion in 'Javascript' started by mk834tt@yahoo.com, Dec 15, 2007.

  1. Guest

    Beginner here.

    Here is the function correctly written:

    function countKids() {
    var body = document.body;
    var kids = body.childNodes;
    var lengthis = kids.length;
    alert("nodes in body = " + lengthis);
    }

    Here is the way I constructed it.

    function countKids() {
    var body = document.body;
    var kids = body.childNodes var lengthis = kids.length;
    alert("nodes in body = " + lengthis);
    }

    If I were using perl, for example, the parser would let me know
    (usually)
    what and where I did the damge. How do you find stuff like that in
    an html file?

    I tried the venkman debugger (Firefox/2.0.0.11, Venkman version
    0.9.87.2) but it wouldn't
    load the functions. The debugger always died in a internal debugger
    script. How do you catch
    these things. Isn't there a little parser that out there to check
    syntax?

    Thanks
     
    , Dec 15, 2007
    #1
    1. Advertising

  2. wrote:

    > Here is the way I constructed it.
    >
    > function countKids() {
    > var body = document.body;
    > var kids = body.childNodes var lengthis = kids.length;
    > alert("nodes in body = " + lengthis);
    > }
    >
    > If I were using perl, for example, the parser would let me know
    > (usually)
    > what and where I did the damge. How do you find stuff like that in
    > an html file?
    >
    > I tried the venkman debugger (Firefox/2.0.0.11, Venkman version
    > 0.9.87.2) but it wouldn't
    > load the functions.


    Check the Firefox error console, it should display an error alike

    Error: missing ; before statement
    Source File: http://example.com/file.html
    Source Code:
    var kids = body.childNodes var lengthis = kids.length;

    and indicate the position.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Dec 15, 2007
    #2
    1. Advertising

  3. Guest


    > Check the Firefox error console, it should display an error alike
    >
    >
    > Martin Honnen
    > http://JavaScript.FAQTs.com/


    OOOO! Thanks Martin.
     
    , Dec 15, 2007
    #3
  4. Paul Lautman Guest

    wrote:
    >> Check the Firefox error console, it should display an error alike
    >>
    >>
    >> Martin Honnen
    >> http://JavaScript.FAQTs.com/

    >
    > OOOO! Thanks Martin.


    Also, install FireBug
     
    Paul Lautman, Dec 15, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    968
    Mark Goldin
    Jan 17, 2004
  2. yawnmoth
    Replies:
    97
    Views:
    4,731
    Bent C Dalager
    Feb 27, 2009
  3. Wybo Dekker
    Replies:
    1
    Views:
    368
    Yukihiro Matsumoto
    Nov 15, 2005
  4. vdvorkin
    Replies:
    0
    Views:
    417
    vdvorkin
    Feb 10, 2011
  5. vdvorkin
    Replies:
    3
    Views:
    818
    vdvorkin
    Feb 14, 2011
Loading...

Share This Page