简体   繁体   中英

Linking a JavaScript file to HTML file not working by any means

I've tried all the posibilities as described in previous similar cases and still no results.

I'm adding the link tags at the end of the of the HTML and I am calling the folder where the file is placed but still nothing.

</div>
<script type="text/javascript" src="../pages/counter.js"></script>

Folder structure:

js文件所在文件夹的截图

It's not clear for me where is the js file. But you should try the same folder: "./pages/counter.js"

Looks like pages has the same hierarchy level as index.html, so the path getting used is incorrect.

Try using the following path:

</div>
<script type="text/javascript" src="./pages/counter.js"></script>

Let me know in case of issues

Seems like your index file is in same directory as of pages. So try

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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