PDA

View Full Version : Putting Javascript in seperate .js page rather than in <head>



flyingpig
07-11-2008, 04:24 PM
1) Script Title: AnyLink Drop Down Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

3) Describe problem: How can I put the javascript bit into a separate .js page rather than in the <head> to try and reduce the size of the webpage.

thetestingsite
07-11-2008, 04:28 PM
Just place everything between the <script> tags in a seperate .js file and call the file in the <head> of the document like so:



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

/***********************************************
* AnyLink Drop Down Menu- Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>


Hope this helps.

flyingpig
07-11-2008, 04:39 PM
Cheers that's helped, sorted it now.