Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is './hello.htm' the same as 'hello.htm'? 1

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
Hi,

Daft question I'm sure, but are the following two lines of HTML identical as far as the browser is concerned?

<img src='./pic1.gif'>
<img src='pic1.gif'>

As a child of the 80's having grown up with DOS I understand that the top line 'reinforces' the fact that the image exists within the current folder, but is it necessary?

- Andy
_______________________________
&quot;On a clear disk you can seek forever&quot;
 
Thanks!

- Andy
_______________________________
&quot;On a clear disk you can seek forever&quot;
 
As stated, yes they are the same, and he's right there is no need to that... here's where it comes from, and where it can be used:

. is THIS working directory that you are currently in
.. is the directory directly &quot;above&quot; the one you are in

lets say you have a directory called web, and in it is an image that is used at the top of every page, called head.jpg. There is a sub directory blah(
Code:
web/blah
) and it's index wants to use that image. On the server, however the main directory with the contents of your web is called let's pretend for this example)... That means that if you type the img tag for the head in the index.html file of the blah directory as
Code:
<img scr=&quot;web/head.jpg&quot;>
when it's uploaded the image will appear broken in the index page of the blah directory. If instead of web, you used www, then viewing it locally would appear broken... The fix:
Code:
<img src=&quot;[b]..[/b]/head.jpg&quot; alt=&quot;head&quot;>
.

Alright, I'm done babling about things we all know already...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top