zoukankan      html  css  js  c++  java
  • 复选框和下拉框js如何操作合格复选框或下拉框中元素

    <div style=" 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=" 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]));



    }






  • 相关阅读:
    Selenium三种等待的使用方式
    mysql中出现没有权限访问或者查看全部数据库的问题---用客户端第一次打开的时候
    报错:1130-host ... is not allowed to connect to this MySql server 开放mysql远程连接 不使用localhost
    PAC全自动脚本代理
    dns是什么
    cdn是什么
    vim替换命令
    linux文件权限赋值
    访问nginx-php页面的时候 报access denied.
    配置php时。提示的错误session_start(): Failed to initialize storage module解决办法
  • 原文地址:https://www.cnblogs.com/mayay/p/6920319.html
Copyright © 2011-2022 走看看