日期:2014-05-18  浏览次数:20722 次

一个下拉框的问题
问:怎么实现下拉框既 "下拉 "又多选,如果只是加multiple,就变的象列表框,这不是我要的效果

------解决方案--------------------
在下拉框里的值前面都加上复选框,通过选择复选框来多选
------解决方案--------------------
<form name= "frm " id=frm action= "xxx.jsp " method= "get " onsubmit= "return frm_onsubmit() ">
<input type= "hidden " name= "aaa " />
<TABLE cellSpacing=0 cellPadding=0 width=500 align=center border=0 >
<tr>
<td>
<table width= "100% " border= "0 " cellpadding= "0 " cellspacing= "0 "
>
<tr>
<td width= "5 " colspan= "3 " > &nbsp; </td>
</tr>
<tr>
<td colspan= "3 " >
<span class= "red-txt "> * </span> 选择XX:
</td>
</tr>
<tr>
<td width= "40% " align= "center " >
供选的XX
<br>
<select multiple name= "column1 " size= "14 " style= "width: 200px; ">
<option id= "1 "> 1111 </option>
<option id= "2 "> 2222 </option>
<option id= "3 "> 3333 </option>
<option id= "4 "> 4444 </option>
</select>
</td>
<td width= "20% " align= "center " >
<p>
<a href= "javascript:madd() "> &gt;&gt; </a>
</p>
<p>
<a href= "javascript:mdel() "> &lt;&lt; </a>
</p>
<p>
<a href= "aaa.html "> &nbsp; 重置 &nbsp;&nbsp; </a>
</p>
</td>
<td width= "40% " align= "center " >
选中的XX
<br>
<select size= "14 " style= "width: 200px; " multiple name= "column2 ">

</select>
<br>
</td>
</tr>
<tr>
<td align= "center " colspan= "3 " >
<a href= "javascript:save() "> 保存 </a> &nbsp;&nbsp;&nbsp;&nbsp;
<a href= "javascript:window.history.back() "> 返回 </a> &nbsp;&nbsp;&nbsp;&nbsp;
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<!--热销产品结束 -->

<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
function madd(){
var i,m_if= "false ";
for (i=window.frm.column1.length-1; i> =0; i--) //循环第一个select框的每一个option
{ if (window.frm.column1.options[i].selected) //如果该option被选中
{ for (var j=window.frm.column2.length-1; j> =0; j--) //循环第二个select框的每一个option
{ //判断第一个select框中的option是否已经被添加,是的话写标记m_if= "true "
if (window.frm.column1.options[i].text==window.frm.column2.options[j].text)
m_if= "ture " ;}
if(m_if== "false "){