Thursday, March 3, 2011

debugging javascript with firebug

Hi,

I cannot seem to debug my javascript code with Firebug. The play button is greyed out. I use FireFox 3.0.4 and Firebug 1.2.1

Are there any known issues?

This is the script i want to debug: (breakpoints set on img onclick and function say), the code executes well.

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <script type="text/javascript" src="jquery/jquery-1.2.6"></script>
        <script type="text/javascript">
            function say(text){
                alert(text);
            }
        </script>
        <title>DOM Level 0 Event Handlers</title>
    </head>
    <body>
        <img onclick="say('Vroom vroom');" id="vstar" src="vstar.jpg" alt="vstar" />
        <div id="console"></div>
    </body>
</html>
From stackoverflow
  • I usually see this behavior if I forget to set a break point, or I have set the break points in places that don't get executed (so execution never stops, so the play button would never do anything).

    Dr. Hfuhruhurr : Even a simple alert('Hallo'), whisch is executed, and breakpoint set, the buttons are greyed out and no debugging
  • Check if you have "support for script debugging" enabled in Console. Its disabled by default for performance reasons.

  • I just checked your script and it debugs ok. Firefox is 3.0.4 and Firebug 1.2.1, same versions.

    To verify everything is done right, lets do a checklist:

    • Open page in FireFox
    • Open Firebug Script Window, check that debugger is enabled
    • set breakpoint on line 6 (function say(text){
    • press F5 / reload page
    • breakpoint is hit and debug arrows light up

    Perhaps you missed the F5 step?

  • You need to close all instances of firefox and reopen. Firefox has shared memory, so you cannot open a new page.

0 comments:

Post a Comment