HighDots Forums  

syntax errors; how to find

Javascript JavaScript language (comp.lang.javascript)


Discuss syntax errors; how to find in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mk834tt@yahoo.com
 
Posts: n/a

Default syntax errors; how to find - 12-15-2007 , 10:30 AM






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

Reply With Quote
  #2  
Old   
Martin Honnen
 
Posts: n/a

Default Re: syntax errors; how to find - 12-15-2007 , 10:39 AM






mk834tt (AT) yahoo (DOT) com wrote:

Quote:
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/


Reply With Quote
  #3  
Old   
mk834tt@yahoo.com
 
Posts: n/a

Default Re: syntax errors; how to find - 12-15-2007 , 10:45 AM




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


Martin Honnen
http://JavaScript.FAQTs.com/
OOOO! Thanks Martin.


Reply With Quote
  #4  
Old   
Paul Lautman
 
Posts: n/a

Default Re: syntax errors; how to find - 12-15-2007 , 01:20 PM



mk834tt (AT) yahoo (DOT) com wrote:
Quote:
Check the Firefox error console, it should display an error alike


Martin Honnen
http://JavaScript.FAQTs.com/

OOOO! Thanks Martin.
Also, install FireBug




Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.