473,785 Members | 2,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

img name or ID

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.
Jul 20 '05 #1
21 11386
I don't know if it is deprecated, it surprises me a bit for there exist a
global collection
document.images
That collection is addressed by numerical indexes or by NAME properties:
document.images["mygifName"].src
this is why if it has been deprectaed it would surprise me. yet everything
is possible...!

Yet, of course getElementById requires an ID="something" .
Of course, you can use both name= and id= in an image - the name to exploit
the document.images collection, the id for getElementById or, let's say,
dhtml
ciao
Alberto Vallini
http://www.unitedscripters.com/

"TheKeith" <no@spam.com> ha scritto nel messaggio
news:JY******** ************@gi ganews.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.

Jul 20 '05 #2
>From: "TheKeith" no@spam.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
getElementBy Id 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.
--
Randy
Jul 20 '05 #3

"HikksNotAtHome " <hi************ @aol.com> wrote in message
news:20******** *************** ****@mb-m27.aol.com...
From: "TheKeith" no@spam.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
getElementBy Id 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.

Yeah I validated an image map where the image has a name attribute in it. I
guess I'm wrong about this one--can't remember where I heard it.
Jul 20 '05 #4
"TheKeith" <no@spam.com> writes:
I heard that the name attribute is deprecated in html 4.01 strict.
Some uses of the name attribute are deprecated in HTML 4.01. That
means that they are removed from HTML 4.01 Strict, and not just
deprecated.
Is it recommended that you use the ID attribute for images along
with the getElementById method instead of the old way?


In HTML 4.01 Strict, if you need to name an element, other than a form
control, you should use the id attribute. It is the only available
attribute.

You can use either document.getEle mentsById or document.images .namedItem
to access an image in W3C DOM 2 HTML. In ECMAScript, using square brackets
is equivalent to using the namedItem method on collections.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #5
TheKeith wrote:
I heard that the name attribute is deprecated in html 4.01 strict.
The `name' attribute for the `img' element is _not_ deprecated:

http://www.w3.org/TR/html4/index/attributes.html#n (no `D' there at `IMG'!)
Is it recommended that you use the ID attribute for images along
with the getElementById method instead of the old way?


That's what the HTML 4.01 Specification recommends but you need to
reconsider that, depending on your target group. If you don't want
to exclude users of UAs not capable of the W3C-DOM like Netscape 4.x,
use the `name' attribute anyway since there is no other way than the
so-called "DOM Level 0"'s document.images[...] collection to access
images.
PointedEars

Jul 20 '05 #6
Thomas 'PointedEars' Lahn <Po*********@we b.de> writes:
the so-called "DOM Level 0"'s document.images[...] collection to access
images.


The document.images collection is actually official DOM 2.
<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-90379117>

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #7
Lasse Reichstein Nielsen wrote:
Thomas 'PointedEars' Lahn <Po*********@we b.de> writes:
the so-called "DOM Level 0"'s document.images[...] collection to access
images.


The document.images collection is actually official DOM 2.
<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-90379117>


Ah, thx :)
\V/ Live long and prosper

PointedEars

Jul 20 '05 #8
TheKeith wrote:
I heard that the name attribute is deprecated in html 4.01 strict.
No. The attribute index in the recommendation from

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

only shows the name attribute of the APPLET tag as being deprecated, but
this follows from the APPLET tag being deprecated. A search through
the DTD itself shows name attributes on various element types, including
IMG.

Is it recommended that you use the ID attribute for images along with the
getElementById method instead of the old way?


Yes and not necessarily.

It recommends to use id on image elements to identify them, but allows
giving them a name attribute (with the exact same value as any id
attribute provided) for backwards compatability.

The DOM2 HTML recommendation describes the document.images collection
without deprecation. It notes for backwards compatability the collection
excludes images included in the document using OBJECT tags, and
recommends using getElementsByTa gName instead of document.images to
"find the images in the document". In the absence of deprecation, I take
this to imply "when the presence of images resulting from OBJECT tag
usage may be at issue".

Using getElementById to find images is perfectly acceptable.

--

Dom


Jul 20 '05 #9
DU
TheKeith wrote:
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 recommend you only use the id attribute for <img> for 2 reasons:
- id is unique when name attribute is not
- if you ever want to convert your HTML 4.01 page to XHTML, then you're
already a step closer since "XHTML 1.0 has deprecated the name attribute
of the a, applet, form, frame, iframe, img, and map elements, and it
will be removed from XHTML in subsequent versions."
http://www.w3.org/TR/2002/REC-xhtml1-20020801/#C_8

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
63699
by: stewart.midwinter | last post by:
No doubt I've overlooked something obvious, but here goes: Let's say I assign a value to a var, e.g.: myPlace = 'right here' myTime = 'right now' Now let's say I want to print out the two vars, along with their names. I could easily do this: print "myPlace = %s, myTime = %s" % (myPlace, myTime)
2
2741
by: Ravi | last post by:
My XML looks like: <abc> <def type="apple"> 1 </def> <def type="peach"> 2 </def> <def type="orange"> 3 </def> <def type="banana"> 4 </def> <def type="plum"> 5 </def> </abc>
1
2629
by: discomiller | last post by:
Mario Mueller: Hello *, radiobuttons belong to other radiobuttons by the "name="any_value"" attribut. Thats a fakt. I got the following XML: **************************************************************
1
5064
by: Prasad Karunakaran | last post by:
I am using the C# DirectoryEntry class to retrieve the Properties of an user object in the Active Directory. I need to get the First Name and Last Name as properties. I know it is not supported with the ADSI NT Provider and only supported in the LDAP Provider. So given an UserId (UID) how can I read the First Name and Last Name using LDAP Provider. If anybody can help me with a C# sample code it would of great help. Thanks in advance.
13
5096
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow only 1 thread per line Trunk_Thread.ApartmentState = ApartmentState.STA
3
11695
by: jparulan | last post by:
Hi All, I'm using SOAP3.0. I was able to successfully call a WSDL file and get a value properly. But when the WSDL changed to have a MULTIPLE <element name> it was failing. This code works BEFORE: strCurrency = oSOAP.eServeSearch(CSTR(Request.Form("T1"))) until the WSDL file changed to have more <element name> T1 is just a field that accepts a STRING
1
5998
by: ivanet | last post by:
Hello everyone, I am trying to use the following Schema but I get the error "src- resolve: Cannot resolve the name 'ValuesList' to a(n) 'element declaration' component." at line 144. I have been reading http://www.w3.org/TR/xmlschema-1/#src-resolve, but I don't get what is wrong. Can anyone give me a hint? Thanks in advance.
2
23754
by: pythonnewb | last post by:
I am fairly new to programming but have some very basic Java background. I am just learning python and tried to make a module that would allow me to create a file containing an address book. I was planning to then create a program to detect input and use this module, but I am hung up. I have constructed the code that I thought would work (though there may be a better way) and I got this error message. Traceback (most recent call last): File...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10329
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10152
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8974
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.