tags:

views:

50

answers:

4

I notice Dreamweaver creates a name attribute automatically with the same value as id, which I wouldn't have thought to do. I read this question asking the difference between name and id attributes in HTML, but what about where it applies to images?

+3  A: 

Expando attributes won't hurt anything in any modern browser. It was officially supported in HTML 4.01, but removed in Strict XHTML:

http://www.w3.org/TR/xhtml1/

Regardless, it is pretty much useless for anything. Dreamweaver has included it for as long as I can remember.

A validator will complain (legitimately so) if you add an unsupported attribute to a tag.

Tim
It *is* an official attribute, at least in HTML 4.
deceze
@deceze: yes, you are correct, I amended my post.
Tim
For information about standards, it's always best to go to the source. http://w3.org :)
deceze
HTML 4 didn't include it. HTML 4.01 did. XHTML removed it. Note section C.8: http://www.w3.org/TR/xhtml1/. +1 for the standards recommendation.
Tim
A: 

Name is pretty much only useful for forms. You can use it as a way to add metadata to images, but there are more standard ways to do that these days.

Alex JL
+1  A: 

name is an attribute included for scripting backwards compatibility and should be of no use today.

http://www.w3.org/TR/html401/struct/objects.html#edef-IMG

name = cdata [CI]
This attribute names the element so that it may be referred to from style sheets or scripts. Note: This attribute has been included for backwards compatibility. Applications should use the id attribute to identify elements.

deceze
A: 

ID attribute should be used for now.

The NAME attribute, added to IMG in HTML 4.01, specifies a name for referring to the image from a client-side script. The ID attribute provides the same functionality, but old browsers such as Netscape 4.x only support the NAME attribute.

Source: http://htmlhelp.com/reference/html40/special/img.html

SteD