SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Guru
    Join Date
    Mar 2004
    Posts
    639
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Confused with debugging scripts in IE

    Hello,

    I've wrote whole the website for Firefox and Firebug always worked for me. It's pretty easy to find where the error is.

    But now, I'm browsing y website in IE and a lot of thing do not work in this browser. I've fixed some of those errors, but I'm totally confused with some other ones.

    For example, I get error "in line 38, character 4". I'm opening page's source HTML code and look into line 38. It's empty.

    How can I find error then? I use some Ajax on this page, could it be reason of the problem? If yes, where should I search for the error (where is this "line 38")?

    If you have some time, can you look here please. Please login first (login "test", password "thetest"), then click "Photo albums", click "Greece", put mouse over Options, click "Map this photo" and you'll see the error.

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The best debugger for IE is the one included with visual studio (I think express has it) and office 2003. Microsoft's free debugger is pretty much broken. You also have to go into IE and turn off the "Disable Script Debugging" option.

  3. #3
    SitePoint Guru
    Join Date
    Mar 2004
    Posts
    639
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chris_fuel View Post
    The best debugger for IE is the one included with visual studio (I think express has it) and office 2003.
    I don't have Office and VS, I don't use Windows much. Is this debugger available without VS or Office? Are there any other debuggers (Firebug-like)?

    Microsoft's free debugger is pretty much broken. You also have to go into IE and turn off the "Disable Script Debugging" option.
    Thanks. These options are turned off.

  4. #4
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just found a nice writeup on Using Web Developer Express for IE Debugging. Check it out, it'll explain how to get a javascript debugger setup.

  5. #5
    SitePoint Guru
    Join Date
    Mar 2004
    Posts
    639
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I installed Visual Web Developer 2008 beta, but it seems it needs Frontpage extensions installed on the server. I've also installed IE Developer Toolbar and DebugBar, but they show same information.

    How can I find where the error is?

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    IE tells you where the error occurred and what the error was, but not in which file. Dumb eh?

    Here's how to debug the problem without the fancy tools.

    After logging on a clicking the link to return to the previous page
    Line 49: 'forms' is null or not an object

    I saved a copy of the source code and add a base element to the head section. This lets me run the code locally where the browser pretends it's running from the server.

    Code HTML4Strict:
    <base href="http://www.roamearth.com/en/?lang=en&sid=364394c4cea16e7d064b77d09b651d7f" />

    The first script file is the editor, and around line 49 of the editor.js file. First I run the local file to confirm that I'm still getting the same error, (I do) then I comment out the editor.js line. No error.

    Now I take the editor.js file and place it inline with the page code. This way the line number for the error matches up with the code, and I can easily make changes to it while the base remains on the server.

    With the code inline, the error now occurs at line 159.
    The problem is occurring at the bottom of this section

    Code Javascript:
    function initInsertions() 
    {
    	var doc;
    	if (document.forms[form_name])
    	{
    		doc = document;
    	}
    	else 
    	{
    		doc = opener.document;
    	}
    	var textarea = doc.forms[form_name].elements[text_name];

    It seems to be a problem of some dependencies that the editor script requires, specifically the form_name variable.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I didn't get any errors in IE 7.

    DebugBar, while not even close to FireBug, is somewhat a help in debugging.

  8. #8
    SitePoint Guru
    Join Date
    Mar 2004
    Posts
    639
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I've removed editorc.js for the "test" user, I get no error, but script still doesn't work.

  9. #9
    SitePoint Guru
    Join Date
    Mar 2004
    Posts
    639
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone please? When I click "Map photo", I can see grey square instead of the map. I don't see any error even with DebugBar and IE Developer Toolbar installed.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •