Iv got a javascript file for a Navigation bar...how would i put it in a html file?

  • Thread starter Thread starter Tobias
  • Start date Start date
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
 
Iv got a javascript file for a Navigation bar...how would i put it in a html file?

Its got a main file called main.JS then a folder called menu with 8 files which are also .JS

How would i put it in a html file?
 
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
 
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
 
Back
Top