473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Has the name attribute deprecated?

Has the name attribute deprecated?

I ask this because ASP.NET 2 warns me against using it, says that it has
been deprecated and doesn't use it (on the client) when creating a radio
button list.

I always thought that a HTML radio button list was made by giving all
the buttons the same name but different IDs?

What's going on here?
Nov 24 '06 #1
11 5794
Jasbird wrote:
Has the name attribute deprecated?
The name attribute has a long and complicated history. It has existed
for various different elements in various different versions of HTML.

HTML 4.01 adds the name attribute to some elements which didn't have it
in HTML 4.0.

XHTML 1.0 deprecates the name attribute for a, applet, form, frame,
iframe, img, and map elements. But not for button, textarea, select,
input, object, param and meta elements.

XHTML 1.1 removes it entirely from a and map elements.
I ask this because ASP.NET 2 warns me against using it, says that it has
been deprecated and doesn't use it (on the client) when creating a radio
button list.
What version of (X)HTML is your code trying to produce?
I always thought that a HTML radio button list was made by giving all
the buttons the same name but different IDs?
Nearly. Same name, different values. IDs are not required for radio
buttons.

Steve

Nov 24 '06 #2
..oO(Steve Pugh)
>Jasbird wrote:
>I always thought that a HTML radio button list was made by giving all
the buttons the same name but different IDs?

Nearly. Same name, different values. IDs are not required for radio
buttons.
You need them if you use label elements.

Micha
Nov 24 '06 #3
Michael Fesser wrote:
.oO(Steve Pugh)
Jasbird wrote:
I always thought that a HTML radio button list was made by giving all
the buttons the same name but different IDs?
Nearly. Same name, different values. IDs are not required for radio
buttons.

You need them if you use label elements.
<label>Is that so? <input name="so" type="radio" value="no" /></label>

You need them if you use explicitly associated label elements (the only
sort that IE6 understands). For implicitly associated labels they are
not needed.

Steve

Nov 24 '06 #4
..oO(Steve Pugh)
>Michael Fesser wrote:
>You need them if you use label elements.

<label>Is that so? <input name="so" type="radio" value="no" /></label>

You need them if you use explicitly associated label elements (the only
sort that IE6 understands).
Correct, I should have mentioned that.
>For implicitly associated labels they are
not needed.
Yep. BTW: Does IE7 support this? I can't test it.

Micha
Nov 24 '06 #5
Michael Fesser wrote:
.oO(Steve Pugh)
For implicitly associated labels [...]

Yep. BTW: Does IE7 support this? I can't test it.
According to a recent thread in alt.html, yes they are.

Steve

Nov 24 '06 #6
On 24 Nov 2006 01:58:55 -0800, "Steve Pugh" <st**********@gmail.com>
wrote:
>Jasbird wrote:
>Has the name attribute deprecated?

The name attribute has a long and complicated history. It has existed
for various different elements in various different versions of HTML.

HTML 4.01 adds the name attribute to some elements which didn't have it
in HTML 4.0.

XHTML 1.0 deprecates the name attribute for a, applet, form, frame,
iframe, img, and map elements. But not for button, textarea, select,
input, object, param and meta elements.

XHTML 1.1 removes it entirely from a and map elements.
>I ask this because ASP.NET 2 warns me against using it, says that it has
been deprecated and doesn't use it (on the client) when creating a radio
button list.

What version of (X)HTML is your code trying to produce?
XHTML 1.0 Transitonal
>I always thought that a HTML radio button list was made by giving all
the buttons the same name but different IDs?

Nearly. Same name, different values. IDs are not required for radio
buttons.
Unfortunately, ASP.NET is not giving the radio buttons any name at all,
but actually allocated the name (I gave the servers-side controls) to a
table (on the client), then gives the client-side radio buttons IDs of:
rad1_0, rad1_1, etc. (when the server-side name is rad1)

I can give the radio button list a event (programmed on the server) -
and ASP.NET then allocates that event to the bloody table - not the
actual buttons (which it places in the table).

Nevertheless, once I figured out what was going on I was able to do my
javascript validation so it's no longer a problem - just a puzzle.

I may try changing the default page spec to validate for HTML 4 in
future, as this attribute-cide I get from constant compiler warnings is
annoying me. As if anyone expects browsers to actually deprecate these
attributes - I bet they'll still be there in 50 years time.
Steve
Nov 25 '06 #7
On Sat, 25 Nov 2006 11:40:28 GMT, Jasbird <Ja*****@houdini.comwrote:
>On 24 Nov 2006 01:58:55 -0800, "Steve Pugh" <st**********@gmail.com>
wrote:
>>Jasbird wrote:
>>Has the name attribute deprecated?

The name attribute has a long and complicated history. It has existed
for various different elements in various different versions of HTML.

HTML 4.01 adds the name attribute to some elements which didn't have it
in HTML 4.0.

XHTML 1.0 deprecates the name attribute for a, applet, form, frame,
iframe, img, and map elements. But not for button, textarea, select,
input, object, param and meta elements.

XHTML 1.1 removes it entirely from a and map elements.
>>I ask this because ASP.NET 2 warns me against using it, says that it has
been deprecated and doesn't use it (on the client) when creating a radio
button list.

What version of (X)HTML is your code trying to produce?

XHTML 1.0 Transitonal
>>I always thought that a HTML radio button list was made by giving all
the buttons the same name but different IDs?

Nearly. Same name, different values. IDs are not required for radio
buttons.

Unfortunately, ASP.NET is not giving the radio buttons any name at all,
but actually allocated the name (I gave the servers-side controls) to a
table (on the client), then gives the client-side radio buttons IDs of:
rad1_0, rad1_1, etc. (when the server-side name is rad1)
Sorry my mistake. It does give the radio buttons a name (rad1), but
gives the same ID to the table they're nested in.
>I can give the radio button list a event (programmed on the server) -
and ASP.NET then allocates that event to the bloody table - not the
actual buttons (which it places in the table).

Nevertheless, once I figured out what was going on I was able to do my
javascript validation so it's no longer a problem - just a puzzle.

I may try changing the default page spec to validate for HTML 4 in
future, as this attribute-cide I get from constant compiler warnings is
annoying me. As if anyone expects browsers to actually deprecate these
attributes - I bet they'll still be there in 50 years time.
> Steve
Nov 25 '06 #8
Scripsit Jasbird:
Sorry my mistake. It does give the radio buttons a name (rad1), but
gives the same ID to the table they're nested in.
Did you really have to quote your entire previous message just to insert
that two-liner?

Have you mentioned the URL of a sample page yet? It might tell us what you
are really talking about.

There is nothing wrong with assigning id="rad1" to a <tableelement, or any
element whatsoever, while still using name="rad1" for a group of radio
buttons. Well, it might not be pragmatically wise, since it makes people ask
strange questions, but there is no technical problem with it.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Nov 25 '06 #9
Steve Pugh wrote:
>XHTML 1.1 removes it entirely from a and map elements.
So... what are you supposed to use instead of <a name="...">, for
anchors in your page where you link to? The kind of links like this:
pageurl#TOP

--
Bart.
Nov 28 '06 #10
..oO(Bart Lateur)
>Steve Pugh wrote:
>>XHTML 1.1 removes it entirely from a and map elements.

So... what are you supposed to use instead of <a name="...">, for
anchors in your page where you link to? The kind of links like this:
pageurl#TOP
12.2.3 Anchors with the id attribute
http://www.w3.org/TR/html401/struct/links.html#h-12.2.3

Micha
Nov 28 '06 #11

Jukka K. Korpela wrote:
[...]
There is nothing wrong with assigning id="rad1" to a <tableelement, or any
element whatsoever, while still using name="rad1" for a group of radio
buttons. Well, it might not be pragmatically wise, since it makes people ask
strange questions, but there is no technical problem with it.
"No technical problem" is somewhat vague. It is standards compliant,
but since IE doesn't make any distinction between name and id
attributes when using script and document.getElementById, there is
certainly a good reason to keeps names independent of IDs.

Try this in IE:

<input name="foo" value="foo input">
<p id="foo">foo paragraph</p>
<button onclick="alert(document.getElementById('foo').tagN ame);">
Show foo's tagName
</button>
--
Fred

Nov 30 '06 #12

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

Similar topics

21
by: TheKeith | last post by:
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.
4
by: Stan Brown | last post by:
In converting my pages to 4.01 Strict, I've been removing ALIGN attributes everywhere. I was surprised to notice that a page that validated contained a <td align=left>. Sure enough, when I...
9
by: aragon | last post by:
Hi all, is it legal to use a fully-numeric string as "name" attribute for the <select> tag in the XHTML standard? E.g.: <form action="action.php" method="get"> <select name="12345"> <option...
1
by: Jenny | last post by:
Hi, Can I create an array of tags by assigning same name to these tags? For example, I have two <p> tags with the same name t1. But document.all.b.value=document.all.t.length does not...
24
by: Chameleon | last post by:
This code does not working in Mozilla. Works fine in IE. -------------- <input type=text value=100 name=textbox> <script> alert(textbox); </script> -------------- This perhaps, because of...
6
by: Dick Watson | last post by:
I had a page that works when setup like this: === <form name="frmCalc" action=""> <script type="text/javascript"> function btnCalc_onclick(abc) { return "got here with " + abc; }
10
by: Man-wai Chang | last post by:
Why 2 reference points? -- iTech Consulting Co., Ltd. Expert of ePOS solutions Website: http://www.itech.com.hk (IE only) Tel: (852)2325 3883 Fax: (852)2325 8288
4
by: andrew | last post by:
Hi, I have routinely added anchors to pages using both name and id: <a name="example" id="example"></a> under the possibly mistaken assumption that at some stage "name" might be deprecated...
16
by: Eric Lindsay | last post by:
I have a bunch of old web pages now in HTML 4.01 Strict I update every now and then with revised material. They were written back when using <a name=" was the normal method of including an anchor....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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...
0
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,...

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.