Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Question re external referencing of .js file

    Hi all,

    I am trying to implement a javascript horizontal navigation menu across a website. The .js file is to be referenced as an external file and is located in the root folder.

    I am able to reference the file from the index/home page which is also at the root level; however, when I am having difficulty referencing the file from a web page in a sub folder.

    I am not a coder and actually this is my first javascript menu implementation attempt. I would greatly appreciate if you the forum members could assist me with the external referencing from a web page inside a sub folder. Thanks. - rk.

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    You have 3 options

    you can point directly to the root level folders by putting a forward slash before the folder name in your url. like so
    Code:
    <script language="JavaScript" type="text/javascript" src="/includes/mymenu.js"></script>
    or you can hardcode in the entire path
    Code:
    <script language="JavaScript" type="text/javascript" src="http://www.mysite.com/includes/mymenu.js"></script>
    or you can navigate through the directory structure by using ../ for each level you need to move down.
    Code:
    <script language="JavaScript" type="text/javascript" src="../includes/mymenu.js"></script>


  •  

    Posting Permissions

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