Javascript error reporting for IE

B

Brian A

I have written some Javascript that works perfectly in Firefox - no
errors reported. The dreaded MSIE 6 produces nothing but a long line
of 'undefinedundefinedundefinedundefinedundefined ....'
Each 'undefined' represents a text node or element I have interted
into the DOM. As far as I can see I have declared all variables and
asigned values so I just can't see what is wrong.
Unfortunately the error reporting in MSIE is very poor indeed. The
line number it reports , for the 'error', is not of any use because
I have my javascripts in separate file to the html.

IE is such a crappy browser compared to Firefox but, as so many people
use it, I have to spend time sorting this out.

Is there any free software available that will give me a more detailed
report of why MSIE 6 is complaining?
Remove 'no_spam_' from email address.
Skype Free Zone!!
 
R

RobG

Brian said:
I have written some Javascript that works perfectly in Firefox - no
errors reported. The dreaded MSIE 6 produces nothing but a long line
of 'undefinedundefinedundefinedundefinedundefined ....'

The usual strategy is to test frequently after every small change.
Don't do 500 lines of code only testing in Firefox then swap to IE - it
just won't work, particularly if you are doing DOM stuff with new code
rather than libraries[1] of tested, cross-platform functions.
Each 'undefined' represents a text node or element I have interted
into the DOM. As far as I can see I have declared all variables and
asigned values so I just can't see what is wrong.

Quite likely you have a single error that is being propagated - post a
minimal example (or link) that shows the error and maybe you'll get
some help.
Unfortunately the error reporting in MSIE is very poor indeed. The
line number it reports , for the 'error', is not of any use because
I have my javascripts in separate file to the html.

Insert an alert at a place that is before where you think the error is.
Move it down the code until it fails, then you know where to start. It
will also give you a key to knowing how the line numbering works - it
actually makes sense once you work it out.

[...]

1. By "libraries" I don't mean things like prototype.js or dojo, but
tried and tested functions that you've compiled into a small utility
library, perhaps on a per project basis.
 
B

Brian A

Brian said:
I have written some Javascript that works perfectly in Firefox - no
errors reported. The dreaded MSIE 6 produces nothing but a long line
of 'undefinedundefinedundefinedundefinedundefined ....'

The usual strategy is to test frequently after every small change.
Don't do 500 lines of code only testing in Firefox then swap to IE - it
just won't work, particularly if you are doing DOM stuff with new code
rather than libraries[1] of tested, cross-platform functions.
Each 'undefined' represents a text node or element I have interted
into the DOM. As far as I can see I have declared all variables and
asigned values so I just can't see what is wrong.

Quite likely you have a single error that is being propagated - post a
minimal example (or link) that shows the error and maybe you'll get
some help.
Unfortunately the error reporting in MSIE is very poor indeed. The
line number it reports , for the 'error', is not of any use because
I have my javascripts in separate file to the html.

Insert an alert at a place that is before where you think the error is.
Move it down the code until it fails, then you know where to start. It
will also give you a key to knowing how the line numbering works - it
actually makes sense once you work it out.

[...]

1. By "libraries" I don't mean things like prototype.js or dojo, but
tried and tested functions that you've compiled into a small utility
library, perhaps on a per project basis.
Thanks to people who posted a reply.
I have sussed out what was wrong with my script. For the benefit of
those reading this post I am reporting details of the error.
I am operating an AJAX regime. I had previously sent raw server data
to the DOM and all had been OK except the formatting wasn't good. I
introduced a few style sheet changes and that fixed it for Firefox but
not IE. Doing things to fix a script, depending on the browser type,
is a bad way of doing things anyway. I set out to write code to format
the data in the DOM so that, hopefully, it would then display OK in
all browsers.
The mistake I made was I treated the incoming data as an array.
Firefox was happy with that but, IE, absolutely correctly, rejected
it. After converting the raw data into an array, before formatting, my
code now works perfectly. So, it wasn't the existing code that was at
fault but the omission of one line of code.
Remove 'no_spam_' from email address.
Skype Free Zone!!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top