首页 > 代码库 > 实现查询条件文本框、下拉表、复选框页面组装
实现查询条件文本框、下拉表、复选框页面组装
<form id="content"> <% if ("OPCODE".equals(dicType)) { %> <div id="opCodeCompent"></div> <% } else if ("CHANNEL".equals(dicType)) { %> <div id="channelCompent"></div> <% } else if ("CITY".equals(dicType)) { %> <div id="cityCompent"></div> <% } else { %> <% } %> </form> <script type="text/javascript"> var dicType = "<%=dicType%>"; var elementType = "<%=elementType%>"; if ("OPCODE" == dicType) { var loadUrl = "/special/anHui/loadSysConfList.action?queryMap.DIC_TYPE=" + dicType; $.get(loadUrl, function (result) { var elementType = "<%=elementType%>"; var elementHtml = ""; $.each(result, function (_inx, _dic) { if ("checkbox" == elementType) { elementHtml = ""; elementHtml = "<input type=\"checkbox\" id=\"opCode_" + _dic.DIC_ID + "\" value=http://www.mamicode.com/"" + _dic.DIC_ID + "\" />" + _dic.DIC_NAME; $("#opCodeCompent").append(elementHtml); } else if ("select" == elementType) { elementHtml = elementHtml + "\n <option value="http://www.mamicode.com/ + _dic.DIC_ID + ">" + _dic.DIC_NAME + "</option> "; if (_inx == result.length - 1) { elementHtml = "<select id=\"opCode_\" name=\"queryMap.opCode\" >" + elementHtml + "\n </select>"; $("#opCodeCompent").append(elementHtml); } } else { $("#opCodeCompent").append(""); } }); }); } else if ("CHANNEL" == dicType) { var loadUrl = "/special/anHui/loadSysConfList.action?queryMap.DIC_TYPE=" + dicType; $.get(loadUrl, function (result) { var elementType = "<%=elementType%>"; var elementHtml = ""; $.each(result, function (_inx, _dic) { if ("checkbox" == elementType) { var innserHtmlValue = "<input type=\"checkbox\" id=\"channel_" + _dic.DIC_ID + "\" value=http://www.mamicode.com/"" + _dic.DIC_ID + "\" />" + _dic.DIC_NAME; $("#channelCompent").append(innserHtmlValue); } else if ("select" == elementType) { elementHtml = elementHtml + "\n <option value="http://www.mamicode.com/ + _dic.DIC_ID + ">" + _dic.DIC_NAME + "</option> "; if (_inx == result.length - 1) { elementHtml = "<select id=\"channel\" name=\"queryMap.channel\" >" + elementHtml + "\n </select>"; $("#channelCompent").append(elementHtml); } } else { $("#channelCompent").append(""); } }); }); } else if ("CITY" == dicType) { var loadUrl = "/special/anHui/loadSysConfList.action?queryMap.DIC_TYPE=" + dicType; $.get(loadUrl, function (result) { var elementType = "<%=elementType%>"; var elementHtml = ""; var rowCount = 0; $.each(result, function (_inx, _dic) { if ("checkbox" == elementType) { rowCount++; if (_inx == 0) { var topElement = "<input type=\"checkbox\" id=\"cityAll\" value=http://www.mamicode.com/"all\" />全部<p>"; $("#cityCompent").append(topElement); } if (rowCount % 5 == 0) { var innserHtmlValue = "<input type=\"checkbox\" id=\"city_" + _dic.DIC_ID + "\" value=http://www.mamicode.com/"" + _dic.DIC_ID + "\" />" + _dic.DIC_NAME + "<p>"; $("#cityCompent").append(innserHtmlValue); } else { var innserHtmlValue = "<input type=\"checkbox\" id=\"city_" + _dic.DIC_ID + "\" value=http://www.mamicode.com/"" + _dic.DIC_ID + "\" />" + _dic.DIC_NAME; $("#cityCompent").append(innserHtmlValue); } } else if ("select" == elementType) { elementHtml = elementHtml + "\n <option value="http://www.mamicode.com/ + _dic.DIC_ID + ">" + _dic.DIC_NAME + "</option> "; if (_inx == result.length - 1) { elementHtml = "<select id=\"opCode_\" name=\"queryMap.cityItem\" >" + elementHtml + "\n </select>"; $("#cityCompent").append(elementHtml); } } else { $("#cityCompent").append(""); } }); }); } else { $("#partCompent").append(""); } </script>
实现查询条件文本框、下拉表、复选框页面组装
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。