Javascript debugging
Discussion
Got a webpage which uses some javascript for ajax type stuff.
Works perfectly well in Firefox and Opera but I get a runtime error in IE.
The error is undefined (handy) and its reporting an error at line 542 char 3
However, it a PHP document that includes the javascript so I dont know which particular piece of javascript its referring to.
Is there anyway to get at the internal document which its rendering the screen from or is there a debugging framework thats better than the version shipped with IE?
Works perfectly well in Firefox and Opera but I get a runtime error in IE.
The error is undefined (handy) and its reporting an error at line 542 char 3
However, it a PHP document that includes the javascript so I dont know which particular piece of javascript its referring to.
Is there anyway to get at the internal document which its rendering the screen from or is there a debugging framework thats better than the version shipped with IE?
OK, maybe crossed wires, whats on line 546 (and 5 lines above/below) of the client generated script (IE->Edit->Source)?
Unless my brains stopped working (be warned it does this from time to time) the line refers to whats been generated after the PHP binary has executed and therefore the error in IE is a script error.
>> Edited by polus on Monday 22 May 12:42
Unless my brains stopped working (be warned it does this from time to time) the line refers to whats been generated after the PHP binary has executed and therefore the error in IE is a script error.
>> Edited by polus on Monday 22 May 12:42
You're better off running the page in a browser, right clicking and doing View Source. Save that file as a .html page and then debug that file. Once you've modified the code you'll need to copy and paste back to your original JavaScript.
Yes, it's a fudge, but JS is a pain to debug at best.
Yes, it's a fudge, but JS is a pain to debug at best.
If you can find a way to present your page with the script referrred to externally rather than inlined in the page source, it's much easier to debug because the IE error handler gives you accurate source locations. Having the source level script debugger should make it fairly straight forward to debug, but if you need to have access to the DOM (as opposed to the HTML page source) to see what is going on, you can use various JScript utilities to show it for you. Google is your friend.
When you say the error is "undefined", what is the actual error message? IIRC, IE tends to use the word undefined when you're trying to use a JS method on an object that it doesn't recognise. This would tie in with it working in one browser, and not in another - have you used a method that IE doesn't know? You may have to install some logic to check the browser type, and use one statement or another depending on whether it's IE or not. (Apologies if I’ve just taught you how to suck eggs.
)
Dan
) Dan
Error: Unknown Runtime Error
Its having issue with the following:
this.construct_playlist = function(playlist_obj)
{
var tracks = playlist_obj.getElementsByTagName("track" );
var playlist = $("playlist_content" );
// Init variables
this.list_pltrack = new Array();
this.pl_selection = new Array
// Clear the playlist
playlist.innerHTML = '';
// Enable commands clear and shuffle if we are tracks in the playlist
var enable = tracks.item(0) ? true : false;
this.enable_command('pl-clear','pl-shuffle',enable);
for (var i=0; track = tracks.item(i); i++)
this.construct_track(playlist,track);
};
The error line as stated is the playlist.innerHTML = '';
Works fine in Firefox...
>> Edited by Plotloss on Monday 22 May 13:42
>> Edited by Plotloss on Monday 22 May 13:42
Its having issue with the following:
this.construct_playlist = function(playlist_obj)
{
var tracks = playlist_obj.getElementsByTagName("track" );
var playlist = $("playlist_content" );
// Init variables
this.list_pltrack = new Array();
this.pl_selection = new Array
// Clear the playlist
playlist.innerHTML = '';
// Enable commands clear and shuffle if we are tracks in the playlist
var enable = tracks.item(0) ? true : false;
this.enable_command('pl-clear','pl-shuffle',enable);
for (var i=0; track = tracks.item(i); i++)
this.construct_track(playlist,track);
};
The error line as stated is the playlist.innerHTML = '';
Works fine in Firefox...
>> Edited by Plotloss on Monday 22 May 13:42
>> Edited by Plotloss on Monday 22 May 13:42
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


