I have all my JavaScript separate from my HTML, different files. All my JavaScript for the whole site is contained in one file called script.js. This is called when the body loads and is obviously referenced in each page:
However on one page of the site, I have links which hide/show page content. This is done using JavaScript and must be called when the page loads. The JavaScript for this is in a separate .js file, called hide.js, because it is specific to this page and also gets referenced:
However the problem is that the hide.js works fine but the script.js is not working at all - almost like it is not being called.
Both js files contain:
I'm not sure if HTML cannot call two JavaScript files or if it has something to do with both files calling window.onload?
Code:
<script type="text/JavaScript" src="script.js"></script>
However on one page of the site, I have links which hide/show page content. This is done using JavaScript and must be called when the page loads. The JavaScript for this is in a separate .js file, called hide.js, because it is specific to this page and also gets referenced:
Code:
<script type="text/JavaScript" src="hide.js"></script>
However the problem is that the hide.js works fine but the script.js is not working at all - almost like it is not being called.
Both js files contain:
Code:
window.onload = setup;
I'm not sure if HTML cannot call two JavaScript files or if it has something to do with both files calling window.onload?