PDA

View Full Version : external script -- active subdirectory?


doggo18
04-28-2003, 10:36 PM
Well I am working on my site, which has alot of subdirectories. Now I have one external .js file, which all my html files, in the same directory, and upto 5 subdirectories deep, all load in their <head> section.

Now the problem, a part of this script wants to load some images. Only it seems like the relative path I specify, is from the html file that is calling the script.. for example I have mysite/sub1/sub2/sub2.html calling mysite/external.js (../../external.js to be precise). When my script wants to load mysite/images/image1.gif with the relative path "images/image1.gif" it fails. It seems like it's taking the path of my sub2.html file. How do I solve this?

Using /images/image1.gif is no option, as it is not the head folder. Nor can I hardcode the path because the path will be changing, depending on the computer I am logged on (stupid school projects!)

Thanks :)

arnyinc
04-29-2003, 02:34 PM
You'll have to refer to it with the full path such as /mywebsite/images/pic.jpg.

doggo18
04-29-2003, 04:35 PM
I am affraid that is not an option in my case :( It's ment to be an offline project for school and the fact that the path in which the site is depends on the client computer (dont ask; its the crappiest network I've ever seen :mad: ) makes me unable to use hardcoded paths like /mysite/image.jpg ...

Is there really no alternative to get the directory with the external file in it without adjusting the file everytime I log onto another school computer? :P

Thanks for the help everybody..