|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
stupid link question
This may seam like a stupid question but here goes. What do the dots and slashes before hyperlinks do? ie: some code I read has ../link.htm some has ./link.htm and some just /link.htm. I know that one is for going back through the directories, but what are the others? Are they typos, alternatives or do they serve some other purpose?
__________________
Gravity always wins |
|
#2
|
|||
|
|||
|
../link.htm is for going back through the directories
./link.htm stands for the current directory /link.htm i'm assuming it means the root directory although i am not 100% sure about that one. Hope that helps. |
|
#3
|
|||
|
|||
|
almost right...
when dots are used, the link is 'relative' to the current document. When slashes are used (without dots), you use absolute links. Absolute links will try to search the exact location of the link, no mather where your page is situated. recap: index.html, ./index.html and ../index.html are relative paths, while HTTP:// links are absolute paths (any other absolute path will probably lead to error messages). |
|
#4
|
|||
|
|||
|
dots and slashes
../index.htm means go one directory up from this one and look for a file called index.htm
../../index.html go 2 directories up ../pages/index.html go up one directory and into the pages directory and look for a file called index.html /pages/index.htm means start from the root directory and follow it down into pages and look for index.htm ./index.htm the dot means present directory. I havent seen it in urls because it's sort of redundent. you say the same thing by just writing index.htm the leading dot in unix environments means to execute the file as in ./script.sh this would run a shell script in this directory ./scripts/help/script.sh would begin looking in the current directory for a directory called scripts and then one called help for a file called script.sh and execute it. |
|
#5
|
|||
|
|||
|
paths
also, http:// is almost always what you'd use to link to a page on another server. You don't have to use it if the link is to something local.
|
|
#6
|
|||
|
|||
|
Re: paths
Quote:
unless you're testing a server-parsed script of your own...
__________________
Click here and wait. It's a kewl effect, trust me. |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > stupid link question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|