任何人都可以告诉我这段代码有什么错误

时间:2016-02-29 06:32:38

标签: javascript

如果我错了,请纠正我

<html>
<body>

<script>

function newyear() {
alert("all the best");
}
>

</script>
<form>
<input type="button" onclick="newyear()" value="newyear" />

</form>
</body>

</html> 

2 个答案:

答案 0 :(得分:1)

<html>
<body>

<script>

function newyear() {
alert("all the best");
}
// remove the extra character here
</script>
<form>
<input type="button" onclick="newyear()" value="newyear" />

</form>
</body>

</html> 

答案 1 :(得分:0)

你有额外的角色(&gt;)。删除它,你的代码没问题。 像这样:

<html>
<body>
<script>
   function newyear() {
   alert("all the best");
   }
</script>
<form>
  <input type="button" onclick="newyear()" value="newyear" />

</form>
</body>