How to execute javascript in different file?

file, html, javascript, onclick

Solution

If the name of the function is still the same, then you don't have to do anything except include the script in your html somewhere before any code uses it, like so:

<script src="/yourscript.js" type="text/javascript"></script>

Problem

I have multiple javascript functions in my html page. One of them, by far the biggest, is executed on a button click. If I moved that function into a separate .js file, what would be the syntax to have the onclick run that file?

Original source