W3C home > Mailing lists > Public > www-html-editor@w3.org > January to March 2002

Discrepancy on attributes of IMG

From: Scott D Friedemann <scott.friedemann@expertune.com>
Date: Wed, 23 Jan 2002 15:27:45 -0600
Message-ID: <61B9192FF436D3118C1500104B364F87143D31@XPTN00>
To: "'www-html-editor@w3.org'" <www-html-editor@w3.org>
On this page

	http://www.w3.org/TR/REC-html40/struct/objects.html

you list


----- snip -----

13.2 Including an image: the IMG element
<!-- To avoid problems with text-only UAs as well as 
   to make image content understandable and navigable 
   to users of non-visual UAs, you need to provide
   a description with ALT, and avoid server-side image maps -->
<!ELEMENT IMG - O EMPTY                -- Embedded image -->
<!ATTLIST IMG
  %attrs;                              -- %coreattrs, %i18n, %events --
  src         %URI;          #REQUIRED -- URI of image to embed --
  alt         %Text;         #REQUIRED -- short description --
  longdesc    %URI;          #IMPLIED  -- link to long description
                                          (complements alt) --
  name        CDATA          #IMPLIED  -- name of image for scripting --
  

--- end snip ---


and yet, any  <IMG>  tag that includes   'name'  will not validate at HTML
4.  

Can you explain this and how to properly code, for example, an image
rollover where the JavaScript is expecting 'name'?

Example source code:

<script type="text/JavaScript" >
<!--

if (document.images) {
  image1on = new Image();
  image1on.src = "productson.jpg";

  image2on = new Image();
  image2on.src = "literatureinfoon.jpg";

  image3on = new Image();
  image3on.src = "trainingcenteron.jpg";

  image1off = new Image();
  image1off.src = "products.jpg";

  image2off = new Image();
  image2off.src = "literatureinfo.jpg";

  image3off = new Image();
  image3off.src = "trainingcenter.jpg";

}

function changeImages() {
  if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src =
eval(changeImages.arguments[i+1] + ".src");
    }
  }
}

// -->
</script>

<a href="products.html" onMouseOver="changeImages('image1', 'image1on')" 
		onMouseOut="changeImages('image1', 'image1off')"> <img
name="image1" src="products.jpg" alt="Products" border=0></a></td>



Thanks and best regards,
 
Scott D Friedemann
ExperTune Inc.
4734 Sonseeahray Drive
Hubertus, WI 53033-9728
email: scott.friedemann@expertune.com
tel: (262) 628-0088
fax: (262) 628-0087
http://www.expertune.com
Received on Wednesday, 23 January 2002 16:27:50 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:14:42 UTC