Attribute for <IMG ...>
SRC = "text string"

SRC tells where to get the picture that should be put on the page. SRC is the one required attribute for <IMG ...>. For example, suppose that the GIF file "../graphics/pumpkin.gif" is in the same directory as this page. We can place it in the page like this:

this code produces this
<IMG SRC="../graphics/pumpkin.gif" ALT="pumpkin">

SRC is a hypertext reference, like the <A HREF="..."> attribute. The reference can be relative (like the example above) or it can be a "fully qualified" reference. The most common use for fully qualified references is for the "access counter" images you see on some web pages. These counters work by calling an image file located on some other web server which specializes in access counters. That server looks at what web page is calling the image (that information is given in the URL), looks at the record for how many times that image has been called, and generates an image file with the numbers in the image. Suppose, for example, there is an access counter located at the server of our friends (there isn't really):

this code produces this
<IMG src="" ALT="counter">

Unfortunately, because it is very common to turn images off, many users never see the access counter. In these situations the page reads like this: "This page has been accessed [image] times".

About the Author
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.