实际项目验证错误

时间:2017-08-10 00:58:18

标签: javascript html

感谢您在我尝试运行验证程序时对某些代码进行疑难解答。我正在研究一个数学项目,并且在这里有更多的代码,我似乎有更多的错误。我试图缓慢地解决错误,但会在早上重试。你们觉得怎么样?

      <!Doctype html>
      <head>
      <Title 1. Mathematics Review </title>
      <script type ='text/javascript'>
      Var someValue;
      someValue='2+2=4';
      someValue='5+2=7';
      alert (someValue);
      </script>
      </head>
      </html>

1 个答案:

答案 0 :(得分:0)

您的代码中有很多错误,我会逐步解释它们。

在第一行,它应该是:

<!DOCTYPE html>

接下来,在第三行中,您缺少&gt;符号,不应该使标记中的第一个字母大写。所以它应该是:

<title> 1. Mathematics Review </title>

当您在javascript中声明变量时,应使用var,而不是 Var 。第五行应该是:

var someValue;

在第六和第七行,我不知道你想做什么。 如果你要告诉javascript计算方程式,你应该这样做:

someValue = 2+2 //not in qotes, and
someValue = 5+2