JavaScript 不显示任何警告对话框

标签 javascript jquery html css

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

相关文章:

javascript - php 不回显 ajax javascript 中的任何内容?

javascript - 单击按钮时自动聚焦到输入(适用于 AMP 文章)

java - 从同一公司网站的不同域获取 cookie

javascript - 数据字段 ="time"不支持 AngularJS 的 ng-model =""

javascript - 在不使用 jQuery 的情况下获取移动设备(尤其是 iPhone)上的窗口高度

Javascript - 获取 switch case 中的 case 数量

javascript - 我在 Canvas 中的 mousedown 函数在被调用时没有重绘背景

jquery如何在悬停时仅更改一个父级

jquery - 设置脚位置

html - 容器中固定和相对 div 的 z-index 问题