未捕获的SyntaxError:意外的标记ILLEGAL

时间:2014-07-08 06:13:59

标签: javascript syntax-error token

我在这个论坛上一直在阅读这个错误,但我找不到任何有用的东西。真奇怪的是我在演讲中从教师那里复制了这个,但它不会超过。有什么想法吗?

<!DOCTYPE html> 
    <html> 
    <head>
     <meta charset="UTF-8">
    <title>Warner: iLab 1  Iteration and Summing Numbers</title>
    </head>
    <body style="font: 100% Ariel;">
    <h2>Iteration |Summing Numbers Between Two Integers |</h2><hr />
    <p>
       <script type="text/javascript">  

         var firstInt = parseInt(prompt("Enter an Integer from 1 and 4",""));
         document.write("Your first Entry: " +firstInt);
         var secondInt = parseInt(prompt("Enter an Integer from 6 and 9",""));
         document.write("<br> Your second Entry: "+secondInt+"<br>);
         var  sumNumbers = 0;
         for(var i=firstInt;  i<=secondInt;  i++)
         {
            sumNumbers += i;
         }
         document.write("<br>The answer is "+ sumNumbers);

       </script>
    </p>
    </body>
    </html>

3 个答案:

答案 0 :(得分:1)

您错过了收尾引号:

document.write("<br> Your second Entry: "+secondInt+"<br>);

答案 1 :(得分:0)

您在这里缺少引号:

 document.write("<br> Your second Entry: "+secondInt+"<br>);

应该是:

 document.write("<br> Your second Entry: "+secondInt+"<br>");

希望这有帮助。

答案 2 :(得分:0)

你应该关闭双引号第4行的脚本。

document.write("<br> Your second Entry: "+secondInt+"<br>");
相关问题