下拉列表该复选框的例子

最近作了一个把只能单选的下拉列表转换成 复选框的例子,整理一下。

以前的

show.jsp

   <input type="hidden" id="sIllId" name="sIllId" value="${sIllId}" />
    <select name="illId" id="illId">
          <option>-----</option>
    </select> 

sql=""and a.IllId.Id=? ""

被改后的

 show.jsp

  <input id="illnames" name="illnames" value="" onClick="selectbox();"/>
 <input type="hidden" name="illId" id="illId" value="${param.illId}">

sql="and instr(?,a.IllId.Id)>0"

下面的js用来获取所选的值传回页面

selectbox=function(){
  perinfo=window.showModalDialog("jsonquery.do?m=getJwIllNamesBox2&randid="+Math.random(),window,"dialogWidth:460px;dialogHeight:420px;center: yes;help:no;resizable:yes;status:yes;scroll=yes");
  if(perinfo!=undefined){
    infoarray=perinfo.split(";");
 illnamesob=document.all("illnames");
 illidsob=document.all("illId");
 illnamesob.value="";
 illidsob.value="";
 for(i=0;i<infoarray.length;i++){
   illarray=infoarray[i].split(",");
   illnamesob.value+=illarray[1]+";";
   illidsob.value+=illarray[0]+",";
 }
 illnamesob.value=illnamesob.value.substring(0,illnamesob.value.length-1);
 illidsob.value=illidsob.value.substring(0,illidsob.value.length-1);
 alert(illidsob.value);
  }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值