Select box with checkboxes

Wonder if you guys can help me?

I want a dropdown box (easy), BUT, I want the content of the drop down box to be a series of checkboxes. I know it can be done in pure XHTML, but a combination of HTML/Javascript/DOM should work ... I think?

Also note, that when the user clicks on the dropdown list, the z-indez of that IFRAME or layer (what ever you use) must be on top of any other control. And, when a user checks on any of the control, and clicks anywhere on the body of the HTML form, the select box should have the values of the checkbox. And when the user clicks on the select box it should check the values the user has checked.

Hope I've made sense?

I know it sounds compliciated, I sure cant do it. Please let me know if its possible?
Who is Participating?
iscodeConnect With a Mentor Commented:
can this be an option for you :)
not possible 'cause the option tag my not contain any other tags, just #PCDATA
mousemat24Author Commented:
How about something that "looks" like a select box, but when you click on it, it opens up as a "like" a select box with checkboxs?
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

well you can write a javascript function which is called when you select something from your pulldown, and then creates a checkbox in the DOM which itself shows your pulldown again with onmouseover event.
or use something like:

  <input type=checkbox ... id="check1" style="display:none" />
  <select name=pulldown >

where you set the chekbox to display:visible ifyou have selected it.
mousemat24Author Commented:

|                  |V|
|                      |
| [X]  test         |
| [X]  testing     |
| [X]  paper      |
| [  ]  pen         |
| [  ]  color       |

The bove is the kind of thing I want, a so called list box with check boxes
As I said: not possible with option tag. Dot. Period.
Did you try my suggestion with the invisible checkbox, which gets displayedon change?

something like:
  <select name=pulldown onchange="document.getElementById('check1').style.display='visible'">

Note that you need to hide all others, and hilight only the one depending on your selection.
mousemat24Author Commented:
Thanks iscode

Thats kinda what I was looking for.
Your welcome mousemat24

Glad I could help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.