一个简单的If ... else块。为什么什么都不做?

时间:2010-02-01 19:35:28

标签: javascript

 <html>
    <head></head>
    <body>
     <script type = "text/javascript">
      var x = 5;
      var y = 8;
      if (x < 6)
      {
       document.write("They are equal");
      }
      else
      {
       document.write{"They are NOT equal");
      }
     </script>
    </body>
</html>

1 个答案:

答案 0 :(得分:12)

我认为你有语法错误:

document.write{"They are NOT equal");

应该是

document.write("They are NOT equal");