From: nick on
On May 9, 6:46 am, SAM wrote:
> Le 5/9/10 8:49 AM, nick a écrit :
> [...]
> > I'm working on another Chrome extension. I want to pop the dropdown
> > open when the user clicks its containing <label>.
>
> <label onmouseover="dropDown(this)" for="select_1">
>         blah blah ... ... :
>         <select id="select_1"
>                 onclick="dropUp(this); doThat(this)">
>          ... ...
> </label>

AFAIK you don't need the 'for' attribute if the control is inside of
the label :)

> function dropDown(what) { what.className = 'open';
> var s = document.getElementById(what.getAttribute('for'));
> s.size = s.length; }
>
> function dropUp(what) { what.tagName=='label'?
>         what.className = '' : what.parentNode.className = ''; }
>
> maybe ?

Hmm, I see where you're going with this.

> and with good css rules ? in this idea :
>
> label { position: relative; border: 3px outset; background:#fff; }
> label select { position:absolute;width:100%;display:none}
> label.open select { display:block }
> label.open select option:hover { background:#ff7 }

Yeah, something like that might work. Might need to set 'multiple'
attribute on the select to get the options showing, or does
display:block take care of that? Thanks for the suggestions, I'll try
this out.

> > [...]

> What you want isn't it a context menu ?
> (I don't know Words, so I can't see its terrrific icon's dropdown)

Think about clicking the 'table' button in this picture and a dropdown
menu appearing :)

http://www.actiprosoftware.com/products/dotnet/WPF/Ribbon/Images/Ribbon.gif
From: David Mark on
nick wrote:
> On May 9, 6:46 am, SAM wrote:
>> Le 5/9/10 8:49 AM, nick a �crit :
>> [...]
>>> I'm working on another Chrome extension. I want to pop the dropdown
>>> open when the user clicks its containing <label>.
>> <label onmouseover="dropDown(this)" for="select_1">
>> blah blah ... ... :
>> <select id="select_1"
>> onclick="dropUp(this); doThat(this)">
>> ... ...
>> </label>
>
> AFAIK you don't need the 'for' attribute if the control is inside of
> the label :)

You don't, but you should avoid that construct for compatibility reasons.
From: RobG on
On May 10, 7:39 am, David Mark <dmark.cins...(a)gmail.com> wrote:
> nick wrote:
> > On May 9, 6:46 am, SAM wrote:
> >> Le 5/9/10 8:49 AM, nick a écrit :
> >> [...]
> >>> I'm working on another Chrome extension. I want to pop the dropdown
> >>> open when the user clicks its containing <label>.
> >> <label onmouseover="dropDown(this)" for="select_1">
> >>         blah blah ... ... :
> >>         <select id="select_1"
> >>                 onclick="dropUp(this); doThat(this)">
> >>          ... ...
> >> </label>
>
> > AFAIK you don't need the 'for' attribute if the control is inside of
> > the label :)

According to the W3C HTML specification, yes. But you presume all
browsers follow the spec.

>
> You don't, but you should avoid that construct for compatibility reasons.

You do if the browser is IE 6, and maybe others.


PS. Hey Nick, there's an Oxford (aka Harvard) comma for you. Do your
worst!

Language warning:
<URL: http://www.youtube.com/watch?v=n43LduK2Yq8 >


--
Rob
From: David Mark on
RobG wrote:
> On May 10, 7:39 am, David Mark <dmark.cins...(a)gmail.com> wrote:
>> nick wrote:
>>> On May 9, 6:46 am, SAM wrote:
>>>> Le 5/9/10 8:49 AM, nick a �crit :
>>>> [...]
>>>>> I'm working on another Chrome extension. I want to pop the dropdown
>>>>> open when the user clicks its containing <label>.
>>>> <label onmouseover="dropDown(this)" for="select_1">
>>>> blah blah ... ... :
>>>> <select id="select_1"
>>>> onclick="dropUp(this); doThat(this)">
>>>> ... ...
>>>> </label>
>>> AFAIK you don't need the 'for' attribute if the control is inside of
>>> the label :)
>
> According to the W3C HTML specification, yes. But you presume all
> browsers follow the spec.
>
>> You don't, but you should avoid that construct for compatibility reasons.
>
> You do if the browser is IE 6, and maybe others.

As mentioned, best to avoid that construct altogether (that's what I
do). Then you can remain blissfully unaware of such idiosyncrasies (as
I am). ;)
From: David Mark on
David Mark wrote:
> RobG wrote:
>> On May 10, 7:39 am, David Mark <dmark.cins...(a)gmail.com> wrote:
>>> nick wrote:
>>>> On May 9, 6:46 am, SAM wrote:
>>>>> Le 5/9/10 8:49 AM, nick a �crit :
>>>>> [...]
>>>>>> I'm working on another Chrome extension. I want to pop the dropdown
>>>>>> open when the user clicks its containing <label>.
>>>>> <label onmouseover="dropDown(this)" for="select_1">
>>>>> blah blah ... ... :
>>>>> <select id="select_1"
>>>>> onclick="dropUp(this); doThat(this)">
>>>>> ... ...
>>>>> </label>
>>>> AFAIK you don't need the 'for' attribute if the control is inside of
>>>> the label :)
>> According to the W3C HTML specification, yes. But you presume all
>> browsers follow the spec.
>>
>>> You don't, but you should avoid that construct for compatibility reasons.
>> You do if the browser is IE 6, and maybe others.
>
> As mentioned, best to avoid that construct altogether (that's what I
> do). Then you can remain blissfully unaware of such idiosyncrasies (as
> I am). ;)

And actually, that's not quite accurate. The fact that IE6 ignores the
implications of that construct is an example of the incompatibilities I
advised to avoid. Without the - for - attribute, IE6 just doesn't make
the connection.