Using include files makes code maintenance much easier.
Shared libraries can be stored in central locations for multiple
applications to access. To create an include file, simple place
the function definitions in a text file, and name it with a ".js"
extension.
script directive. An example follows.
Here is the main file, test1.htm:
<html>
<head>
<title>ttt</title>
<script src="test2.js">
</script>
</head>
<form>
<input type="button" value="Test Fn" onclick="f_test1()">
</form>
</html>
Here is the include file, which contains a function:
function f_test1()
{
alert("Test1 function")
}
When the button is pressed, the included function is called.