so we are kinda new to programming, and are having issues linking the javascript file to the HTML file. As you can see in the image, index.html is the file we are trying to link to the javascript file.
We have tried these at the bottom of the body tag in index.php:
<script type="text/javascript" src="javascript/script.js"></script>
<script type="text/javascript" src="/javascript/script.js"></script>
<script type="text/javascript" src="../javascript/script.js"></script>
<script type="text/javascript" src="../../javascript/script.js"></script>
<script type="text/javascript" src="../../../javascript/script.js"></script>
<script type="text/javascript" src="../../../../javascript/script.js"></script>
https://i.stack.imgur.com/4UlGO.png
CodePudding user response:
<script src='../../../javascript/script.js'></script>
add this between <head>
& </head>
section of the html document.
CodePudding user response:
You can refer to the two below links:
https://www.w3schools.com/tags/att_script_src.asp
https://www.codegrepper.com/code-examples/html/how to link a js file to html