<div style="width: 510px; border: 1px grey solid; border-right: 1px gray; padding-top: 1px;" id="heddendiv"> <div> <ul id="addressul" class="ul_s"> </ul> <div style="color: #ccc; position: absolute;padding-top:1px;padding-left:5px" id="textDiv1" onclick="document.getElementById(‘serach‘).focus();"> </div> <input type="text" name="serach" id="serach" class="inputs" style="width: 500px;padding:2px;display:inline;" onblur="if(this.value==‘‘&&document.getElementById(‘addressul‘).childNodes.length==0)document.getElementById(‘textDiv1‘).style.display=‘inline‘;" onfocus="document.getElementById(‘textDiv1‘).style.display=‘none‘"> </div></div> js:
//添加选中的关键字function addLi(name,id,type,typeName){ var addUl =jQuery("#addressul"); var addUlLi =jQuery("#addressul li"); if(addUl && addUlLi.length<5){ superType = type; var textWidth = jQuery("#serach").css("width"); if(name.length>15){ name=name.substring(0,15); } for(i=0;i<addUlLi.length;i++){ var tmpLi = addUlLi.eq(i); if(tmpLi.attr("id")=="li_"+id){ alert(name+" 已选择,请勿重复选择!"); return; } } addUl.append("<li id=\"li_"+id+"\" name="+name+" value="+id+">"+name+"<img src=\"/images/section/tp.gif\"></li>"); jQuery("#li_"+id+" img").unbind().click(function(){removeLI("li_"+id)}); var liWidth = jQuery("#li_"+id).css("width"); var lastWidth = parseInt(textWidth)-parseInt(liWidth)-4; jQuery("#serach").css("width",lastWidth); jQuery("#serach").focus(); }else{ alert("接收人最多不得超过5人!"); jQuery("#serach").focus(); }}后台:
String otherPerson = data.getRequest().getParameter("otherPerson");//myy
if(otherPerson!=null){ String others[]=otherPerson.split(","); for(int i=0;i<others.length;i++){ if(others[i]!=null&&!"".equals(others[i])){ tousers.add(others[i]); } }
service.sendMsg(msg, tousers.toArray(new String[0]));
}
时间: 2024-10-16 22:04:31