Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > syntax errors; how to find

Reply
Thread Tools

syntax errors; how to find

 
 
mk834tt@yahoo.com
Guest
Posts: n/a
 
      12-15-2007
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
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-15-2007
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/
 
Reply With Quote
 
 
 
 
mk834tt@yahoo.com
Guest
Posts: n/a
 
      12-15-2007

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


OOOO! Thanks Martin.
 
Reply With Quote
 
Paul Lautman
Guest
Posts: n/a
 
      12-15-2007
wrote:
>> 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

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to exclude action of Find::Find::find in subdirectories withknown names? vdvorkin Perl Misc 3 02-14-2011 05:28 AM
How to exclude action of Find::Find::find in subdirectories withknown names? vdvorkin Perl Misc 0 02-10-2011 05:18 PM
Syntax highligth with textile: Syntax+RedCloth ? gabriele renzi Ruby 2 12-31-2005 02:44 AM
Find.find does not find orphaned links? Wybo Dekker Ruby 1 11-15-2005 02:50 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57