动态向select multiple多选框添加元素

<select ondblclick="this.removeChild(this.options[this.selectedIndex])" multiple >双击移除</option> -->
</select>

 

在js(<script></script>的)方法

<script>

function select(desc1,showstring){
var sell=document.getElementById('select1');
if(sell.length==0){

$('#select1').append(showstring);/* alert("第一个"); */}
else{
/* alert("已有"+sell.length); */
var qq="ture"
for(var i=0;i<sell.length;i++){
if(desc1==sell.options[i].text){
qq="false";
alert(desc1+"此选项已选择,不能重复选择");
return;
}
}
if( qq="ture"){
$('#select1').append(showstring);
}
}
}

</script>

 

 

 

 

 

 

 

 修改页面的初始化select

<select ondblclick="this.removeChild(this.options[this.selectedIndex])" multiple >大類折扣:${DCTP.DValue}%,${DCTP.detail}-${Itemss.desc1}</option>
</c:if>
</c:forEach>
</c:forEach>
</c:if>
</select>

相关文章: