PDA

View Full Version : Really basic stuff - please help



russellcurtis
10-13-2002, 12:51 AM
I am trying to reference in an image on my site. Ok, that sounds easy. I want this image to be on every page of my site, no matter where the page is. I do not want to alter the code on every page depending upon how deeply that page is located. However, as I am using lots of images on each page, I do not want to have to use the following:

<img src="http://www.mysite.com/images/image.gif">

as all those DNS queries will slow me down. So here's the rub...how can I reference images relative to the root of the site, rather than the page itself? I have tried the following:

<img src="/images/image.gif">

expecting the first forward slash to reference the root. IT DOES NOT WORK!

I am getting desperate - can someone please tell me what I am doing wrong? I am using MS IIS 5 on a Win2k machine, if that makes a difference.

Cheers

Russell

redmeat
10-13-2002, 02:24 AM
\dirName/ will take you to the root dir and then into dirName , another example.

\include/javascript/

would take you to the root and then into the include dir, and then into the JavaScript dir.

Roy Sinclair
10-14-2002, 04:25 PM
Originally posted by redmeat
\dirName/ will take you to the root dir and then into dirName , another example.

\include/javascript/

would take you to the root and then into the include dir, and then into the JavaScript dir.

Backslash (\) is not a valid character in html so that is not a good solution even if a certain very commonly used browser is so crass as to accept it in the place of the forward slash (/).

What Russell is using is the correct form for the url so the fact that it isn't working suggests a different kind of problem. I would guess that his pages have a <base> tag in the head which is overriding the true base for the document and causing the malfunction of his relative urls.