![]() | |
#11
| |||
| |||
|
#12
| |||
| |||
|
|
DU wrote: Even the HTML 4.01 recommendation also recommends, prefers id attribute over name attribute for <img>: "This attribute (name) has been included for backwards compatibility. Applications should use the id attribute to identify elements." http://www.w3.org/TR/html401/struct/...#adef-name-IMG |
#13
| |||
| |||
|
|
I heard that the name attribute is deprecated in html 4.01 strict. |
#14
| |||
| |||
|
|
"DU" <drunclear (AT) hot-R-E-M-O-V-E-mail (DOT) com> wrote in message news:bni5pn$no6$1 (AT) news (DOT) eusc.inter.net... DU wrote: Even the HTML 4.01 recommendation also recommends, prefers id attribute over name attribute for <img>: "This attribute (name) has been included for backwards compatibility. Applications should use the id attribute to identify elements." http://www.w3.org/TR/html401/struct/...#adef-name-IMG I'll use the ID attribute from now on especially since I'm learning--there's no point in learning an old way of doing something. I might as well keep everything uniform by using ID for everything. |
#15
| |||
| |||
|
#16
| |||
| |||
|
|
I converted several pages from xhtml 1.0 strict to xhtml 1.1 just after the W3C validator included xhtml 1.1. |
|
There was little change required on most pages. |
|
And then I came to a set of linked pages that used "name". The validator found an error for every name I used, and I had to convert about 50 names to id. |
#17
| |||
| |||
|
|
I converted several pages from xhtml 1.0 strict to xhtml 1.1 just after the W3C validator included xhtml 1.1. |
|
There was little change required on most pages. |
|
And then I came to a set of linked pages that used "name". The validator found an error for every name I used, and I had to convert about 50 names to id. |
#18
| |||
| |||
|
|
From: "TheKeith" no (AT) spam (DOT) com I heard that the name attribute is deprecated in html 4.01 strict. Is it recommended that you use the ID attribute for images along with the getElementById method instead of the old way? Thanks. I just validated a page, with html4.01 strict, that has name attributes in the img tags and it validated fine. So I doubt that its been deprecated. If it has, then the validator at w3c is wrong. |
#19
| |||||
| |||||
|
|
ciao uhm why not using both? I mean an old way of doing soemthing doesn't age: the document.images collection is an useful tool: it grants you the option to loop throughout ALL the available images with an array already arranged. |
|
otherwise you'd have to arrange it yourself, either patching up a collection by repeatedly calling in document.getElementById('image101') or by document.getElementsByTagName("A") the former is highly unpractical |
|
an object which is already within the built in arrays of a loaded document. |
|
It is not an issue of purist vs moderns: it is that I'm suggesting: use both - dismissing the name just because they ADDED the id feature doesn't mean you have to give up the possibility to scan all your images with an alrerady available collection. Again, name= is NOT deprecated. |
|
Of course, feel free to dismiss my suggestion, but please: it is NOT a suggestion of "old school" vs "new school": it is the suggestion that everybody with javascript expereince would be likely to lend to you. Of course, eventually do as you prefer. yet using two weapons instead than one is better - we have not given up the rifle because we have the scuds. ciao Alberto http://www.unitedscripters.com/ |
#20
| |||||||||
| |||||||||
|
|
Vicomte De Valmont wrote: uhm why not using both? I mean an old way of doing > > soemthing doesn't age: An old way of doing something does not age if it is not > deprecated. Name |
|
attribute for <img> is deprecated in XHTML; accessing the collection document.images is not deprecated in XHTML. So there is no contradiction here. |
|
otherwise you'd have to arrange it yourself, either patching up a collection by repeatedly calling in document.getElementById('image101') or by document.getElementsByTagName("A") the former is highly unpractical What's highly unpractical when using, calling, resorting to an attribute with a single, unique attribute value in a document? |
|
The facts are: 1- document.getElementsByName is slower and more memory demanding than |
|
document.getElementById 2- document.getElementById is better supported by browsers, more reliable, more recommendable and more relevant than document.getElementsByName |
|
, the second is much slower than just using an object which is already within the built in arrays of a loaded document. |
|
The issue was name versus id for <img>. The issue was not id versus collection of tagname. The subject line for this thread was clear. |
|
Again, name for <img> (and for several other elements) is deprecated in XHTML 1. In HTML 4, name vs id for <a> is a different issue: |
|
"Use id or name? Authors should consider the following issues when deciding whether to use id or name for an anchor name: * The id attribute can act as more than just an anchor name (e.g., style sheet selector, processing identifier, etc.). * Some older user agents don't support anchors created with the id attribute. * The name attribute allows richer anchor names (with entities)." |
![]() |
| Thread Tools | |
| Display Modes | |
| |