• Web
  1. ")
  2.                 {
  3.                     try
  4.                     {
  5.                         if (((string[])Session["obj"])[Convert.ToInt32(no) - 1] == "")
  6.                         {
  7.                             switch (defaultvalue)
  8.                             {
  9.                                 //add by chairuirui 2013-10-12 start QC注册小组登记表中的注册部门,默认就是创建者的部门
  10.                                 case "dept":
  11.                                     if (Session["UP"] != null)//add by chairuriui 2013-7-5 只有创建的时候才能是最新的数据赋值
  12.                                     {
  13.                                         //Add by zbl 2016-6-26 Start 部门质量目标检查管理,新建报告时,部门不能给默认值;否则,初始化时根据"部门"获取不到"编号"信息
  14.                                         ")
  15.                                         {
  16.                                             break;
  17.                                         }
  18.                                         //Add by zbl 2016-6-26 End 部门质量目标检查管理,新建报告时,部门不能给默认值;否则,初始化时根据"部门"获取不到"编号"信息
  19.  
  20.                                         string upType = clsCommon.JsDecodeURIComponent(Session["ModelName"].ToString());
  21.                                         ((string[])Session["obj"])[Convert.ToInt32(no) - 1] = upType;
  22.                                         value = upType;
  23.                                     }
  24.                                     break;
  25.                                 //add by chairuirui 2013-10-12 end QC注册小组登记表中的注册部门,默认就是创建者的部门
  26.                                 default:
  27.                                     ((string[])Session["obj"])[Convert.ToInt32(no) - 1] = defaultvalue;
  28.                                     value = defaultvalue;
  29.                                     break;
  30.                             }
  31.                         }
  32.                         string titleType = "";
  33.                         titleType = contentValue;
  34.                         DataSet sel = IARREP.GetNameByGroup(titleType);
  35.                         string selectOnchangeFunction = string.Empty;//A1表TableType:02 责任单位NO:31
  36.                         string strOutsourcing = string.Empty;//外包/外购
  37.                         string strGroup = string.Empty;//集团内/集团外
  38.  
  39.                         string[] strSelectedText = value.Split(new
    char[] { ';' });//选中项显示值
  40.                         // string[] sel = contentValue.Split(',');
  41.                         if (sel != null)
  42.                         {//onchange=onchangeSel('{0}',80,'{0}');SelectIndex({0}," + type + "," + Session["TYPE"].ToString() + ",'" + TileName + "')
  43.                             html.AppendFormat(@"<td {1} bgcolor='#F2F9FF' style='width:500px'><div style='position:relative'><input class='DXText' type='text' readonly='readonly' id='{0}' name='mytextbox' style='width:200px' value='{2}' /><div id='DXSelect' style='position:absolute; display:none; background:#DDEBFF; border:1px solid #8CE5FB; width:200px; top:26px; left:0px' ><ul id='ul_damainList'>", no, (selectOnchangeFunction == string.Empty ? "calss='view-item-td'" : "style='width:180px'"), value);
  44.                             int tnum = sel.Tables[0].Rows.Count;
  45.                             for (int i = 0; i < tnum; i++)
  46.                             {
  47.                                 string valname = sel.Tables[0].Rows[i]["modelName"].ToString();
  48.                                 #region Mod by tanpeng 2012-08-27 修改新建时生成下拉列表的选中
  49.                                 if (value != string.Empty)
  50.                                 {
  51.                                     if (i < strSelectedText.Length)//防止数组超出界限
  52.                                     {
  53.                                         if (strSelectedText[i] == valname)
  54.                                         {
  55.                                             //选中时
  56.                                             html.AppendFormat("<li style='list-style-type:none' class='oddli'><input type='checkbox' class='licheckbox' checked='checked' value='{0}'/>{0}</li>", valname);
  57.                                         }
  58.                                         else
  59.                                         {
  60.                                             html.AppendFormat("<li style='list-style-type:none' class='oddli'><input type='checkbox' class='licheckbox' value='{0}'/>{0}</li>", valname);
  61.                                         }
  62.                                     }
  63.                                     else
  64.                                     {
  65.                                         html.AppendFormat("<li style='list-style-type:none' class='oddli'><input type='checkbox' class='licheckbox' value='{0}'/>{0}</li>", valname);
  66.                                     }
  67.                                 }
  68.                                 else
  69.                                 {
  70.                                     html.AppendFormat("<li style='list-style-type:none' class='oddli'><input type='checkbox' class='licheckbox' value='{0}'/>{0}</li>", valname);
  71.                                 }
  72.                                 #endregion
  73.                             }
  74.                             html.AppendFormat("<li style='list-style-type:none'><input type='button' id='QDing' onclick=onchangeDX('{0}',0,'{0}');SelectIndex({0}," + type + "," + Session["TYPE"].ToString() + ") value='确定'/>&nbsp&nbsp&nbsp&nbsp<input type='button' id='QXiao' value='取消'/></li>", no);
  75.                             html.AppendFormat("</ul></div></div>");
  76.                             html.AppendFormat("</td>");
  77.  
  78.                             if (((string[])Session["obj"])[Convert.ToInt32(no) - 1] == "")
  79.                             {
  80.                                 if (string.IsNullOrEmpty(defaultvalue))
  81.                                 {
  82.                                     defaultvalue = value;
  83.                                 }
  84.                                 ((string[])Session["obj"])[Convert.ToInt32(no) - 1] = defaultvalue;
  85.                                 ((string[])Session["obj2"])[Convert.ToInt32(no) - 1] = value;
  86.                             }
  87.                         }
  88.                     }
  89.                     catch (Exception ex)
  90.                     {
  91.                         throw
    new System.ArgumentOutOfRangeException("出现位置错误:", ex);
  92.  
  93.                     }
  94.  
  95.                 }
  • Javascript
  1. (function($) {
  2.             // 这里依然可以继续使用 jQuery 的 $
  3.             jQuery(".DXText").focus(function(){//聚焦执行函数
  4.                 jQuery("#DXSelect").show();//显示div
  5.             })
  6.             jQuery("#QXiao").click(function(){
  7.                 jQuery("#DXSelect").css("display","none");
  8.             })
  9.         })(jQuery);
  10.         //add gbb 2016/8/2 多选下拉框 start
  11.         function onchangeDX(no,type,typeNo){
  12.             var liLength = jQuery("#ul_damainList li.oddli").length;
  13.             var DXText;
  14.             for(var i = 0; i < liLength; i++){
  15.                 var inputElement = jQuery("#ul_damainList li.oddli input.licheckbox")[i];
  16.                 if (inputElement.checked) {
  17.                     if (DXText!=undefined) {
  18.                         DXText=DXText+inputElement.value+";";
  19.                     }else {
  20.                         DXText=inputElement.value+";";
  21.                     }
  22.                 }
  23.             }
  24.             if (DXText==undefined) {
  25.                 jQuery(".DXText").val("");
  26.             }else {
  27.                 jQuery(".DXText").val(DXText);
  28.             }
  29.             jQuery("#DXSelect").css("display","none");
  30.             _searchCont = "CLICK,selCom," + typeNo + "," + DXText;
  31.             CallServer(_searchCont, "下拉框选值");
  32.         }

Jqure实现下拉多选的更多相关文章

  1. 我的第一个jquery插件:下拉多选框

    <!DOCTYPE HTML> <html> <head> <title> New Document </title> <meta n ...

  2. multiSelect 下拉多选插件

    multiSelect是一款很好用的下拉多选插件,可以在下拉框中实现多选框,全选及取消全选等方法.使用方法:1.引用 multiSelect.css及 multiSelect.js.下载地址 http ...

  3. Easyui datagrid combobox输入框下拉(取消)选值和编辑已选值处理

    datagrid combobox输入框下拉(取消)选值和编辑已选值处理 by:授客 QQ:1033553122 测试环境 jquery-easyui-1.5.3   需求场景 如下,在datagri ...

  4. 使用jQuery为文本框、单选框、多选框、下拉框、下拉多选框设值及返回值的处理

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  5. angular2.x 下拉多选框选择组件

    angular2.x - 5.x 的下拉多选框选择组件 ng2 -- ng5.最近在学angular4,经常在交流群看见很多人问 下拉多选怎么做... 今天就随便写的个. 组件源码 百度云   链接: ...

  6. 品优购商城项目(二)AngularJS、自动代码生成器、select2下拉多选框

    品优购商城想项目第二阶段 AngularJS.自动代码生成器.select2下拉多选框 完成了课程第三天.第四天的的任务. 1.学习了AngularJs前端的mvc分层思想,js部分分成control ...

  7. 自己用ul模拟实现下拉多选框,

    模拟实现下拉多选框 效果如下 <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...

  8. 关于knockout下拉多选值的应用

    在最近的开发过程中,应用了一些关于knockout的下拉项目. 关于下拉多选的开发在这里做一个记录. 下面直接上代码 添加的时候,无需给初始值 --viewmodel function ViewMod ...

  9. jquery--获取多选框的值、获取下拉多选框的值

    获取多选框的值 var packageCodeList=new Array(); $('#server_id:checked').each(function(){ packageCodeList.pu ...

随机推荐

  1. 【UVA10829】 L-Gap Substrings (后缀数组)

    Description If a string is in the form UVU, where U is not empty, and V has exactly L characters, we ...

  2. NBU是最牛逼的备份软件

    NBU是最牛逼的备份软件 TSM是IBM的备份   好好看看几个厂商 VERITAS 公司下的NBU入门级备份有BEHP的备份软件有DPIBM的是TSMCommvault也非常牛逼这都是做到了小机AI ...

  3. win7 下与mac虚拟机的共享文件的建立

    1. 确保针对Mac虚拟机的VMware Tools的安装 加载进入系统后,在mac里可看到安装和卸载vmware tools的两个图标(点开vmware tools磁盘),点安装的就可以了. 2. ...

  4. Delphi 编写的Web Service

      一编写服务程序 第一步:File----->New----->Other------>WebServices----->Soap Server Application选择I ...

  5. Linux学习笔记18——信号1

    一 信号的基本概念 信号:是向进程发送的软件通知,通知进程有事件发生. 生成:表示一个信号的产生. 捕获:表示接收到一个信号. 信号的寿命:信号的生成和传递之间的时间间隔. 挂起的信号:已经生成但还未 ...

  6. del重复数

    楼主 发表于: 2010-06-21 11:46:31 本帖最后由 luckycynthia 于 2010-06-21 11:47:46 编辑 在抓取数据后对数据进行操作的途中,有时候会碰到重复数据, ...

  7. This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery 解决方法

    This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'的意思是,这版本的 MySQL 不支持使 ...

  8. spring maven pom

    https://spring.io/blog/2009/12/02/obtaining-spring-3-artifacts-with-maven/

  9. 《Linear Algebra and Its Applications》-chaper3-行列式-克拉默法则

    计算线性方程组唯一解的克拉默法则:

  10. 《University Calculus》-chape5-积分法-积分的定义

    这一章节讨论积分的定义以及微积分基本定理. 笔者先前在数学证明专栏中关于高斯定理的证明的开头,给出了一段关于微积分思想的概括,文中提到根据导数(微分)的定义,根据其逆定义来给出积分的定义和计算方法,这 ...