Search code examples
javascripthtmlfunctionpopupjsfiddle

How can i add a javascript file in html page?


Hello everyone and thank you for your time! I have a simple question for you.. I have an html page where is only a basemap (open street map). And i have also a javascript file, where it takes your coordinates and it counts a percentage. How can i embed this javascript file in the html page? I mean i want the html page to call this javascript file and after all, to appear a pop-up window where it appears this message: "the percentage is..."

Note: This percentage (line) from the javascript file is that:

console.log("percentage:",(counter/(data.length/4))*100)

Link to Fiddle:

https://jsfiddle.net/irinikonsta/ho4281z1/5/

It's for my diploma thesis...Thank you in advance!


Solution

  • You need to add script tag inside your head tag in your HTML file.

    <script src="script.js"></script>