简体   繁体   English

Uncaught SyntaxError:意外的令牌非法

[英]Uncaught SyntaxError: Unexpected token ILLEGAL

I have been reading up on this error on this forum but am not finding anything that is helping. 我在这个论坛上一直在阅读有关此错误的信息,但找不到任何有帮助的信息。 The really odd thing is that I copied this from my instructor in a lecture but it will not run past the . 真正奇怪的是我在一次演讲中从老师那里抄袭了这本书,但是它不会超越本书。 Any ideas? 有任何想法吗?

<!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>

您缺少右引号:

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

You are missing a quotes here: 您在这里缺少引号:

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

Should be: 应该:

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

Hope this helps. 希望这可以帮助。

您应该关闭双引号脚本的第四行。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM