One js script for multiple local html pages

Hello guys , in my app I have a list which has 4 links , every link targets a local html page like this :

<a href="histroy.html">histoy</a>

The main html page 's name is index.html wich has a script for js at the end of the body tag

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

The issue is that I want to use the same script for history.html and give it its onwn javascript code , but it is not working
even though I have put the same script in history body tag but it is not working .
could any one please help me .


I don’t know if it will solve the problem but

<a href="histroy.html">histoy</a>

You misspelt history.html

No it doesn’t , because in my code it is correct , I misspelt it only here .

Unfortunately we can not really help much with code you’ve posted. Without seeing the code for the history.html page, all we could offer is basic troubleshooting (Make sure all your tags are properly closed, check for spelling errors, make sure the .js file is in the same folder as the html or properly address if not, ect… ) Assuming you have looked for those things, then we would really just need to see the code.