OnlineWebTools

How to import Javascript code from external file in HTML

If your Javascript code is too big or just for readability and management purposes, it’s best to include Javascript codes from an external file. This method is also good for reusability purposes.

The code below will load the Javascript code stored in myscript.js to the calling file.

<script language="JavaScript" type="text/javascript" src="myscript.js"> </script>
Exit mobile version