Forum Moderators: open
I made a file called functions.js which is, you guessed it, JavaScript functions.
Is this how I add it (it works fine):
<head>
<script type="text/javascript" src="functions.js"></script>
</head>
I should use the "type=..." right? Should I put anything else in there? I just want to make sure.
Emperor
BTW, you can use pretty much any text file extension for your scripts, not just .JS. You are telling the browser what MIME type to use with your SCRIPT reference, so it will chew up .JS, .TXT, .HTML, .SCRIPT, .WHATEVER ...
<script type="text/javascript" language="javascript" src="myscript.xyz"></script>
As long as "myscript.xyz" is Javascript, you're set.
(I mention this as a teeny security note, in case you want an extra layer between the obvious file types and potential abuse.)