External JavaScript

Hello, I'm currently working on a HTML file where I link an external JavaScript file so that I don't have to keep writing out large functions within the HTML itself. I'm using the <script> tags but when I run the HTML it doesn't seem to be executing the function form the JavaScript, here is a simplified example to demonstrate what I mean:



<h1>This is a test</h1>

// Importing JavaScript file (I've checked that the file path is correct)
<script type="text/javascript" src="LargeFunctions.js">

// Attempting to use a JavaScript function created in the imported file






function externalTest()
alert("If this message is displayed then the javascript file has been successfully linked to the html");

As you can see the externalTest() function should display alert text as soon as I load the web page, but instead it just does nothing, I don't understand why this would be the case, so if anyone could help me out that would be great. Thanks in advance.


Sign In or Register to comment.