Click to See Complete Forum and Search --> : javascript src= code


tasneem
12-26-2002, 12:46 AM
My scripts are in script folder in the root directory. Some of my files are in a subweb. the code
<SCRIPT language="JavaScript" src="../scripts/**.js" type="text/javascript"></SCRIPT>
does not work. So how can I point to my scripts from the subwebs?

ShrineDesigns
12-26-2002, 12:58 AM
"../" tells the browser that the file is not in this directory; but in the directory containing this directory

this isn't as easy to explain as it is to use lol

example:
if you have "index.html" in your main directory and "this.js" in sub-directory "js" to link this.js to index.html you would do this src="js/this.js"
if you have "page.html" in a sub-directory and you want to link it to "this.js" you can do this src="../js/this.js" or use the absolute url

tasneem
12-27-2002, 05:06 PM
Thanks for yr help. I tried all the things, the script works fine if I call it from a subfolder, but it gets confused when I try it out on a subweb. Any ideas ?
The script is the navigation menu. The other scripts work fine from the subweb, only the navigation gets really confusing. For e.g. - I am on main page, then I go to the subweb, but when I try to come back to main page, the script looks for the main page in the subweb instead of the root web. I think I'll forget the subwebs and stick with folders only.
Thanks very much again.
Happy New Year and Enjoy Your Holidays !!
You can see the above at http://www.des-us.com

ShrineDesigns
12-27-2002, 05:46 PM
<script language="javascript1.2" src="scripts/customwithfaq.js"></script>

you forgot the "../" for this line on deenilogin.html

you want to go through an check if every page is correctly done

tasneem
12-29-2002, 07:10 PM
thanks again
i just rewrote the entire menu scripts in each subweb to point to the main page with absolute url. i'll keep on trying different ways still.
thanks a bunch.