I built a script which generates dynamicaly a list according to check boxes checked. The phoney thing is that the list woun't stay open when click the arrow, so I can not select an option... Any ideea?
PHP Code:
<html>
<head>
<script>
function bla(){
var o1 ='<option>';
var o2 = '</option>';
var c='';
var a = new Array()
for(i=0;i<document.forms[0].elements['ch'].length;i++){
a[i] = document.forms[0].elements['ch'][i];
if(a[i].checked == true){b=o1+a[i].value+o2;}
else{b='';}
c=c+b;
}
document.getElementById('sel').innerHTML = '<select>'+o1+o2+c+'</select>';
}
</script>
</head>
<body onclick="bla()">
<form>
<input name="ch" type="checkbox" value="one" onclick="bla()">
one <br>
<input name="ch" type="checkbox" value="two" onclick="bla()">
two <br>
<input name="ch" type="checkbox" value="three" onclick="bla()">
three <br>
<input name="ch" type="checkbox" value="four" onclick="bla()">
four <br>
<input name="ch" type="checkbox" value="five" onclick="bla()">
five <br>
<br>
<div id="sel">
</div>
</form>
</body>
</html>
Comment