Forum Moderators: open
I just wanted to check whether it's okay to give id a different value or another way round this? I was always under the impression that they should have the same value... Help! I'm a bit confused!....
Thanks in advance for any help you can give me :)
The id Attribute replaces the Name Attribute(Cite [w3schools.com], emphasis original).
HTML 4.01 defines a name attribute for the elements a, applet, frame, iframe, img, and map. In XHTML the name attribute is deprecated. Use id instead.
This is wrong:<img src="picture.gif" name="picture1" />
This is correct:<img src="picture.gif" id="picture1" />
Note: To interoperate with older browsers for a while, you should use both name and id, with identical attribute values, like this:<img src="picture.gif" id="picture1" name="picture1" />
IMPORTANT Compatibility Note:
To make your XHTML compatible with today's browsers, you should add an extra space before the "/" symbol.
Also, even in HTML 4...
name = cdata [CS](Cite [w3.org], emphasis added).
This attribute names the current anchor so that it may be the destination of another link. The value of this attribute must be a unique anchor name. The scope of this name is the current document. Note that this attribute shares the same name space as the id attribute.
Try garann's suggestion and you should be good to go. :)
Jordan
HTML 4.0's ID attribute is intended to eliminate the need for A NAME. The ID attribute can be used with almost any element to define a link destination, so that the following could be used in place of the previous example:<H1 ID=foo>My heading</H1>
However, browser support for ID link destinations is very poor, so A NAME will be needed for quite awhile.
What is the current status of browser support for ID? Is there any point in converting NAME to ID in an HTML context?