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!
Directory Root URL
Moderator: General Moderators
Re: Directory Root URL
../ doesn't mean the document root. It means the directory above the current one. / means document root 
-
jalbautista
- Forum Newbie
- Posts: 5
- Joined: Mon Jul 20, 2009 10:50 am
Re: Directory Root URL
@jackpf .. You're right!
. But still I can't understand this problem heheh.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Directory Root URL
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
../ 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