debugging javascript

Scott Elcomb psema4-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Sun Aug 31 15:27:14 UTC 2008


On Sun, Aug 31, 2008 at 9:20 AM, Paul King <sciguy-Ja3L+HSX0kI at public.gmane.org> wrote:
> I am teaching myself AJAX, and have now gotten to the point where no
> syntax errors are reported. I am using Javascript and HTML for now, to
> get a dropdown menu.
>
> The failed script follows an example in Steven Holzner's Ajax Bible pp
> 379-400. It's at: http://hackingajax.alimentarus.net/sixth.shtml, if
> anyone wants to see the error console.
>
> I have tried ddd, greasemonkey, and a number of other debuggers,
> including firefox's own error console, under Linux. All of them have
> seem to have this same screwball way of numbering the lines. Apparently
> the error is being reported on line 344 on a file which has only 150 or
> so lines.
>
> When seen under Explorer, the page is completely blank.
>
> If anyone can shed light on this issue, I would be grateful.


Off the top of my head I can think of two ways that line numbers might
be reported wrong:

1) Javascript code is dynamically written into the existing document -
say with document.createElement('script')

2) A pre-existing object method or function block is unintentionally
referenced and/or modified.

You might be running into a variation of #2...  a possible typo in the
name of MouseEvent.  Lines 7 & 35 both reference "mouseEvent" although
one starts with a capital M and the other doesn't.  IIRC there is also
a pre-defined function by that name.

Try changing one of the above lines so that both 'mouseEvent'
references use the same case.

My HDD failed and I'm running under Knoppix until I get my new drive
setup (tomorrow); I can't verify that this is a working fix until
then*.  It does get rid of the errors though.


Here's a couple other communities you might find useful:

comp.lang.javascript:
  http://groups.google.ca/group/comp.lang.javascript

ajax-web-technology:
  http://groups.google.ca/group/ajax-web-technology

HTH.
- Scott.


* There's no http daemon on the disc I'm running so I can't test the
AJAX calls.  I also don't have my regular development environment in
place.  :(
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list