+ 1
Is it okay to have 1 .js file for each html page?
Like 1 js file containing functions for Home page, 1 js file containing functions for About page and so on?
3 odpowiedzi
+ 1
Thanks for the quick response.
Can I write it like this?
for index.html:
<html>
<body>
<script src="index.js"></script>
</body>
</html>
for about.html:
<html>
<body>
<script src="about.js"></script>
</body>
</html>
for contact.html:
<html>
<body>
<script src="contact.js"></script>
</body>
</html>
----------------------------
How can I link them all together in the main index file?
0
Yes you can do so and link them all together in the main index file
- 1
https://teamtreehouse.com/community/how-to-link-a-javascript-file-to-indexhtml-file
If you are using php too then use include and require property to include files