473,387 Members | 1,669 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.

<label> with <select> in IE6

Hello,

I am used to using the label tag with check boxes and radio buttons in
html forms. This allows me to click on the text of the label to
activate/deactivate the check box / button, rather than having to
click on the (possibly small) box or button.

I recently tried to assign a label to a select "drop down list", but
found that when I clicked on the label text to bring it into focus,
the select box was reset to the first entry. Is this normal?

The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?

Is it wrong to assign a label to a select box?

Sample URL is: http://www.sindar.net/html-reference.html (scroll way
down to the bottom of the page).

Thanks,

Brian.
Jul 23 '05 #1
5 8284
Brian Foley wrote:
I recently tried to assign a label to a select "drop down list", but
found that when I clicked on the label text to bring it into focus,
the select box was reset to the first entry. Is this normal?
Most likely not. The Specification says only:

"When a LABEL element receives focus, it passes the focus on to its
associated control." [1]

There is no mention nor anything that would imply that an implementation
should move the selected entry, in the case of a menu element.
The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?
Hum... I can't think of anything decent.
Is it wrong to assign a label to a select box?
Definitely not!
Sample URL is: http://www.sindar.net/html-reference.html (scroll way
down to the bottom of the page).


I could confirm the reported (mis)behavior on MS IE 6.0.2900.2180 on
Windows XP SP2. Normally, one would suggest the submission of a bug
report, but I don't think IE is going to receive any attention before
Longhorn.

[1] http://www.w3.org/TR/html4/interact/forms.html#h-17.9.1

Regards,

--
Ney André de Mello Zunino
Jul 23 '05 #2
Ney André de Mello Zunino <zu****@inf.ufsc.br> wrote:
Normally, one would suggest the submission of a bug
report, but I don't think IE is going to receive any attention before
Longhorn.


After the recent announcement about IE 7 for Windows XP, I would be more
optimistic about this. Not very optimistic, though.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #3
/Brian Foley/:
The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?

Is it wrong to assign a label to a select box?


No, it is not wrong. It is just IE is wrong, as usual. :-)

Notice when you specify an 'accesskey' for the label (it is the only
way you could specify an 'accesskey' for a SELECT element) and use
that key to activate the select box - the "reset" behavior doesn't
happen.

--
Stanimir
Jul 23 '05 #4
Brian Foley wrote:
I recently tried to assign a label to a select "drop down list", but
found that when I clicked on the label text to bring it into focus,
the select box was reset to the first entry. Is this normal?

The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?


Here's a quick JavaScript workaround:
<http://tw.ecritters.biz/html_examples/ie_select_labels/>.
Jul 23 '05 #5
* Leif K-Brooks <eu*****@ecritters.biz> on Sun, 20 Feb 2005 06:45:42 -0500 wrote:
Here's a quick JavaScript workaround:
<http://tw.ecritters.biz/html_examples/ie_select_labels/>.


Thanks Leif -- very helpful.

I think, though, that it may simply be better to drop the labels from
my select elements. I usually lay my forms out in a two column th/td
table, so I suppose the relationship is obvious even without the
label.

Its a shame though...

Brian.
Jul 23 '05 #6

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

Similar topics

5
by: cedawe | last post by:
I have two select boxes. When the user picks a value in the first one it completely re-populates the second one. It works fine, but only generates a standard OPTIONS list and I now want to group...
10
by: Ryan McGeary | last post by:
In a <select> drop-down, the onchange event isn't called when scrolling through the dropdown using the mouse-wheel and when crossing over a new <optgroup>. Using the example below, notice how...
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...
7
by: Cezary | last post by:
Hi. I want to change language on my site online. So, I wrote this: <form action="<?= preg_replace("/&/", "&amp;", $_SERVER) ?>" method="post" name="change_lang_form"> <p...
2
by: VK | last post by:
A while ago there was a discussion how to implement a select list that would call a function right upon new selection is being made w/o clicking any additional buttons: ...
7
by: lambertb | last post by:
Hi, is this possible to achieve this, and how? http://img217.imageshack.us/img217/779/derrrvw2.png thanks!
7
by: Smokey Grindle | last post by:
How can you correctly use the <labelelement in asp.net? does the label custom control corelate to this tag correctly in the same way in that if you click it it will select the tied element? thanks
3
by: Homer J. Simpson | last post by:
I have the following stored procedure: ALTER PROCEDURE . AS BEGIN SET NOCOUNT ON; SELECT COUNT(*) FROM QUICKNOTES END ....and the following data source in my .aspx file:
12
by: LayneMitch via WebmasterKB.com | last post by:
Hello everyone. I'm currently learning Javascript and doing a few exercises. One problem I'm working on takes an array of names from an xml file using Ajax and writes it to...
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: 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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
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...

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.