Advanced Search

Results 1 to 3 of 3

Thread: Putting Javascript in seperate .js page rather than in <head>

  1. #1
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Putting Javascript in seperate .js page rather than in <head>

    1) Script Title: AnyLink Drop Down Menu

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...pmenuindex.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.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Just place everything between the <script> tags in a seperate .js file and call the file in the <head> of the document like so:

    Code:
    <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.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. The Following User Says Thank You to thetestingsite For This Useful Post:

    flyingpig (07-11-2008)

  4. #3
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Cheers that's helped, sorted it now.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •