T
Tobias
Guest
It's pretty easy putting a reference to a JS file into a HTML file.
1. Insert the following line for each JS file into the HEAD area of the HTML file:
<!-- Including Javascript file main.js -->
<script type="text/javascript" src="main.js" />
2. Now you can call functions of the JS file directly from the HTML file. This is done the following way (example: onload event handler of body tag (this would by the way execute the function when the page is loaded)):
<body onload="MyFunction();">
This works same with every other event handler. Informations on handling events in JavaScript:
http://www.javascriptkit.com/dhtmltutors/domevent1.shtml
1. Insert the following line for each JS file into the HEAD area of the HTML file:
<!-- Including Javascript file main.js -->
<script type="text/javascript" src="main.js" />
2. Now you can call functions of the JS file directly from the HTML file. This is done the following way (example: onload event handler of body tag (this would by the way execute the function when the page is loaded)):
<body onload="MyFunction();">
This works same with every other event handler. Informations on handling events in JavaScript:
http://www.javascriptkit.com/dhtmltutors/domevent1.shtml