<html>
<head>
<title>BD Home page</title>
<style>
body { background-color:red; }
p { background-color:yellow; }
div { background-color:green; }
</style>
</head>
<body>
<script>
function mf() {
Var x = new Date();
alert("Today is: " + x);
}
</script>
<button onclick="mf()">Click</button>
<div>Hellllllooooo</div>
<p>Hello this is html</p>
</body>
</html>
您好,我是一名初级程序员。在错误代码中,它表示 mf 未在第 1:1 行定义,无法理解。在函数下包含一个警告对话框很重要吗?
最佳答案
使用 var
而不是 Var
。 Javascript var
关键字必须是简单的字母
关于JavaScript 不显示任何警告对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37055759/