Page 1 of 1

Directory Root URL

Posted: Tue Oct 06, 2009 10:19 pm
by jalbautista
Hello! I'm trying out jQuery for the first time. I downloaded the file and save it in my javascripts folder of my website (htdocs/tuklass/javascripts). I'm using Dreamweaver. My problem is how to use the src attribute of the script tag. I don't know why I had inconsistency problems with this.

My document root is htdocs. In one of my pages, add_class.php (in htdocs/tuklass/classes), I placed this code:

<script type='text/javascript' src='../tuklass/javascripts/form.js' ></script>

I know that "../" means the document root. This page works. But in my exam_prac.php (in htdocs/tuklass/exams), this code:

<script type="text/javascript" src="../tuklass/javascripts/jquery-1.3.2.min.js" ></script>

doesn't work at all! When I use the autofill feature of dreamweaver, it tells me to write "../javascripts/jquery-1.3.2.min.js", saying that "../" or the document root is htdocs/tuklass. After changing it, the code works. Please help me! I'm really confused.

Thanks in advance!

Re: Directory Root URL

Posted: Wed Oct 07, 2009 5:46 am
by jackpf
../ doesn't mean the document root. It means the directory above the current one. / means document root ;)

Re: Directory Root URL

Posted: Sun Oct 11, 2009 8:46 pm
by jalbautista
@jackpf .. You're right! :D. But still I can't understand this problem heheh.

Re: Directory Root URL

Posted: Sun Oct 11, 2009 9:14 pm
by John Cartwright
When the current active directory is "htdocs/tuklass/javascripts", and you apply this path ../tuklass/javascripts/jquery-1.3.2.min.js, you are essentially giving it the path: htdocs/tuklass/tuklass/javascripts.

../ means one step back in the directory tree, in your case when your CWD is javascripts folder, one step back would be htdocs/tuklass/, therefore, you only need to apply the path as ../javascripts/jquery-1.3.2.min.js