Link to home
Start Free TrialLog in
Avatar of mousemat24
mousemat24

asked on

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?
Thanks
Mousemat24
Avatar of ahoffmann
ahoffmann
Flag of Germany image

not possible 'cause the option tag my not contain any other tags, just #PCDATA
Avatar of mousemat24
mousemat24

ASKER

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?
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 >
     <option>string</option>
     <option>checkme</option>
   ...
    </select>

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

 ------------------
|                  |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.
ASKER CERTIFIED SOLUTION
Avatar of iscode
iscode

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks iscode

Thats kinda what I was looking for.
Your welcome mousemat24

Glad I could help
iscode