日期:2014-05-16 浏览次数:20641 次
function subCompany(parentID, companyID, name) { this.parentID = parentID; //总公司ID this.companyID = companyID; //分公司ID 下拉框的value this.name = name; //分公司名 下拉框的text }????
var subCompanys = new Array();?
这段代码要写在js标签里 <c:forEach var="subCompany" items="${formCommand.subCompanyCollection}"> subCompanys.push(new subCompany( "<c:out value="${subCompany.parentID}"/>", "<c:out value="${subCompany.sid}" />", "<c:out value="${subCompany.name}" />")); </c:forEach>??
function companyChangeEdit(obj) { var parentID = obj.value; var subCompanySelect = obj.form.subCompany;// 显示分公司的下拉框 subCompanySelect .options.length = 1; for(var i=0; i < subCompanys.length; i++){ var subCompanyObj = subCompanys[i]; if(subCompanyObj.parentID == parentID){ var oTempOption = document.createElement("option"); oTempOption.text = subCompanyObj.name; oTempOption.value = subCompanyObj.companyID; subCompanySelect .options[subCompanySelect .options.length] = oTempOption; } } if(obj.form.parentCompany.selectedIndex == 0){ obj.form.subCompanySelect .selectedIndex = 0; } }?
总公司的 <select name="parentCompany" onChange="companyChangeEdit(this);"> <option value="-1"> 请选择总公司 </option> <c:forEach var="company" items="${formCommand.companyCollection}"> <option value="<c:out value="${company.sid}" />" <c:if test="${company.sid == formCommand.companyId}">selected</c:if>> <c:out value="${company.name}" /> </option> </c:forEach> </select>???
分公司的 <select name="subCompany"> <option value="-1"> 请选择子公司 </option> <c:forEach var="subCompany" items="${formCommand.currentSubCompanyCollection}"> <option value="<c:out value="${subCompany.sid}" />" <c:if test="${subCompany.sid == formCommand.subCompanyID}">selected</c:if>> <c:out value="${subCompany.name}" /> </option> </c:forEach> </select>?
?嗯? 就这些了 总的思想是把所有数据加载到页面上先, 然后在由javascript 来负责显示
没有用ajax? 项目要求(经理的)
?
还有一种方法是?隐藏的iframe 我没有那么作?因为还要写个页面 我觉得不爽
希望大家有什么好方法拿出来讨论啊? 我就会这么多 还是个菜鸟啊?
?