简体   繁体   English

未捕获的引用错误-未定义functionName

[英]Uncaught reference error - the functionName is not defined

Here is my HTML file 这是我的HTML文件

<!DOCTYPE html>
<html lang="e">
<head>
<meta charset="UTF-8">
<title> Practice Java Script </title>
<link rel="stylesheet" href="cssjs/csspracticejs.css">
<script scr="javajs/java.js"></script>
</head>
<body>
<h1>Changing the Style</h1>
<p>JavaScript can change the style of an HTML element.</p>
<button type="button" onclick="openMe()">Open!</button>
<button type="button" onclick="closeMe()">Close!</button>
<p id="demo">Extra details...You can open and close this paragraph using the 
buttons above.</p>
</body>
</html>

And here is my javascript 这是我的javascript

    function closeMe(){
    x=document.getElementById("demo");
    x.style.display="none";
}

    function openMe(){
    x=document.getElementById("demo");
     x.style.display="block";}

But when I try to run it, it appears as Uncaught ReferenceError: closeMe is not defined at HTMLButtonElement.onclick (HTML.html:13). 但是,当我尝试运行它时,它显示为Uncaught ReferenceError:在HTMLButtonElement.onclick(HTML.html:13)上未定义closeMe。 Could you please help to see where i did wrong ? 你能帮我看看我做错了什么吗?

There is typo error during importing script. 导入脚本时出现拼写错误。

It should be <script src> not <script scr> . 它应该是<script src>而不是<script scr>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM