JavaScript外部脚本alert()函数无法正常工作

时间:2015-07-19 20:08:42

标签: javascript

我有一些简单的事情。我有一个html文件和JavaScript文件。在JavaScript文件中调用了简单的alert()函数,但它不起作用!

我在JavaScript文件中写了第二行,以确保我没有给出错误的路径console.log(),并且它按预期工作。

HTML:

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>Demo</title>
</head>
<body>

    <div id="container">

    </div>

    <script src="functionality.js"></script>
</body>
</html>

在外部JavaScript文件中:

alert('hello'); // does not get executed
console.log( 'hello' ); // gets executed

为什么这不起作用?

1 个答案:

答案 0 :(得分:3)

您可能已在Chrome浏览器中按下“阻止此页面创建其他对话框”。尝试重新启动它。

相关问题