简体   繁体   English

我的外部JS文件有问题

[英]I am having issues with an external JS file

I am new to JavaScript. 我是JavaScript新手。 I have an external js file linked to a page, but its just not working. 我有一个链接到页面的外部js文件,但它无法正常工作。 I don't know the line i went wrong in the js file. 我不知道我在js文件中出错的那一行。 Help, please 请帮助

 function show_alert() { alert("Hello! I am an alert box!"); } 
 <input type="button" onclick="show_alert()" value="Show alert box" /> 

This is the code i used to link the file 这是我用来链接文件的代码

<head>
<script type="text/javascript" 
src="js\popup.js"></script>
</head>

First check the console in the Developer tools of your browser for any errors ( use F12 or Ctrl + Shift + I to open dev tools). 首先,在浏览器的开发人员工具中检查控制台是否存在任何错误(使用F12或Ctrl + Shift + I打开开发工具)。 If there's no error in the console, then check if the file path you stated is present in the directory you are. 如果控制台中没有错误,请检查您所声明的文件路径是否在您所在的目录中。

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

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