Firefox Javascript 调试器不起作用 - 按钮变灰

Firefox Javascript debugger doesn't work - buttons grayed out

提问人:stupidmoron 提问时间:10/15/2015 最后编辑:Sarjan Desaistupidmoron 更新时间:10/15/2015 访问量:803

问:

我正在尝试在Firefox的调试器中调试JavaScript,它不会让我设置任何断点,并且所有步骤按钮(单步执行,单步执行)都显示为灰色。我也尝试了 Firebug,我得到了完全相同的结果 - 没有断点,步骤按钮变灰了。什么给了?这是我在这里的第一篇文章,我为我在这里混乱的代码道歉。无论如何,这是我的代码:

<?xml version - "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Page 452 - Exercise 11.7</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial scale=1.0">
    <script>
        function buttonClicked() {
            var article = ["the", "a", "one", "some", "any"];
            var noun = ["boy", "girl", "dog", "town", "car"];
            var verb = ["drove", "jumped", "ran", "walked", "skipped"];
            var preposition = ["to", "from", "over", "under", "on"];
            var story = "Once upon a time, ";
            var sentence = "";
            alert (sentence);
            var output = document.getElementById("textArea");
            output.value = "";

            for (var i=0; i<=3; i++){
                sentence += article[Math.floor(Math.random()*article.length)] + " ";
                alert(sentence.charAt(0));
                alert("Story is " + story);
        /*  if (charAt(sentence[0-3]) == ".") {
            sentence +=
        } */
        sentence += noun[Math.floor(Math.random()*noun.length)] + " ";
        sentence += verb[Math.floor(Math.random()*verb.length)] + " ";
        sentence += 
        preposition[Math.floor(Math.random()*preposition.length)] + " ";
        sentence += article[Math.floor(Math.random()*article.length)] + " ";
        sentence += noun[Math.floor(Math.random()*noun.length)] + ".  ";
        story += sentence;
        output.value = story;
        window.alert (sentence);
        window.alert (story);
            //  sentence ="";

        }
        story += "THE END";
         // output.value = sentence;
     }
    </script>
</head>
<body>
    <p>Click the button for a funny story!<br/>
        <input type="button" id="go" onclick="buttonClicked()"            value="Go!"/><br/></p>
        <textarea id="textArea" rows="10" cols="30"></textarea>

</body>
</html>
javascript 调试 firefox-developer-tools 单步执行

评论

0赞 Callahad 10/15/2015
步骤按钮显示为灰色是有道理的 - 如果您没有命中断点,则无需执行任何操作。当您尝试设置断点时,您到底在做什么,到底发生了什么?您可以在其他站点上设置断点吗?它应该通过单击调试器面板中的行号来工作。
0赞 stupidmoron 10/15/2015
问题是,我添加了几个断点,但按钮仍然显示为灰色。我正在尝试学习如何使用Firefox调试器,使用视频 youtu.be/r1-96MgrfMo
0赞 Callahad 10/15/2015
设置断点后是否刷新页面?

答: 暂无答案