Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 04:16 PM
Nick
Guest
 
Posts: n/a
Default Make an element in a multiple list unselectable???

Is it possible through css to make an element in a multiple list menu
unselectable. Im organizing my list by using titles...

+-------------+
| CATEGORY 1 |
| option 1 |
| option 2 |
| option 3 |
| CATEGORY 2 |
| option 1 |
| option 2 |
| option 3 |
| CATEGORY 3 |
| option 1 |
| option 2 |
| option 3 |
+-------------+

Id like to make the CATEGORIES unselectable. Thanks! -Nick
  #2  
Old July 20th, 2005, 04:16 PM
Steve Pugh
Guest
 
Posts: n/a
Default Re: Make an element in a multiple list unselectable???

nboutelier@hotmail.com (Nick) wrote:
[color=blue]
>Is it possible through css to make an element in a multiple list menu
>unselectable.[/color]

I'm presuming that you mean a <select> element rather than just an
ordinary list of links.

Why with CSS? CSS is for presentation. Making something unselectable
sounds like functionality to me.

The disabled attribute exists for the option element. But Windows IE
doesn't support it. :-(
[color=blue]
>Im organizing my list by using titles...
>
> +-------------+
> | CATEGORY 1 |
> | option 1 |
> | option 2 |
> | option 3 |
> | CATEGORY 2 |
> | option 1 |
> | option 2 |
> | option 3 |
> | CATEGORY 3 |
> | option 1 |
> | option 2 |
> | option 3 |
> +-------------+
>
>Id like to make the CATEGORIES unselectable. Thanks! -Nick[/color]

Looks like you want the optgroup element.

<select name="foo">
<optgroup label="CATEGORY 1">
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
</optgroup>
<optgroup label="CATEGORY 2">
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
</optgroup>
<optgroup label="CATEGORY 3">
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
</optgroup>
</select>

Works in most modern browsers. In older browsers the options are
presented as normal but the labels aren't presented at all.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve@pugh.net> <http://steve.pugh.net/>
  #3  
Old July 20th, 2005, 04:17 PM
Jukka K. Korpela
Guest
 
Posts: n/a
Default Re: Make an element in a multiple list unselectable???

Steve Pugh <steve@pugh.net> wrote:
[color=blue]
> Looks like you want the optgroup element.[/color]

Maybe. But in the absence of a URL to demonstrate what he is really
doing, my verdict is that he wants to create an expensive plastic
simulation of a hierarchic list of links.
[color=blue]
> Works in most modern browsers. In older browsers the options are
> presented as normal but the labels aren't presented at all.[/color]

OK, let's say that it works in 95 % of browsing situations (as far as
_rendering_ is considered). The actual figure is probably somewhat
smaller. Anyway, even 5 % of possible users is a huge number. Is it
acceptable that the fallback has no label texts? I would answer:
yes, _if_ the labels are just for grouping options that are
understandable on their own. But it would be disastrous if e.g. some
options were identical, relying on the category labels for
disambiguation.

It's possible to create a hierarchic menu inside a form without using
optgroup, namely by using grouped radio buttons, see
http://www.cs.tut.fi/~jkorpela/forms....html#optgroup

Massive crossposting triggered the usual "set Followup-To at random"
function. In future, the OP should spend some time in analyzing which
is _the group_ for his question.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles