//=================公司类方法===================//
public String getDrop(String compid,String dataid) throws Exception{
if(str.IsEmpty(dataid) )
dataid="AAA";
Compid com[]=this.readAll(compid,dataid);
StringBuffer bf = new StringBuffer();
if(com.length > 0){
for(int i=0;i<com.length ;i++){
if(dataid.equals(com[i].getBh()) )
bf.append("<option value=" + com[i].getID() + " selected >" + com[i].getName() + "</option>") ;
else
bf.append("<option value=" + com[i].getID() + ">" + com[i].getName() + "</option>") ;
}
}
return bf.toString();
}
//=================部门类方法同上===================//
//====================页面调用=====================//
Compid com = new Compid();
Deptid dep = new Deptid();
Deptid [] depAll=bm.readAll("","");
<select name="deptid" style="width:120px">
<option value="">所有公司
<%=com.getDrop(compid,deptid)%>
</select>
<select name="deptid" style="width:120px">
<option value="">所有部门
<%=dep.getDrop(compid,deptid)%>
</select>
<script language=javascript>
var bm= new Array();
<%if(depAll.length>0){
for(int i=0;i<depAll.length;i++){%>
bm[<%=i%>] = new Array("<%=depAll[i].getCom()%>","<%=depAll[i].getID()%>","<%=depAll[i].getName()%>");
<%}}%>
function setBm(){
document.form_com_dep.deptid.length = 0;
document.form_com_dep.deptid.options[document.form_com_dep.deptid.length] = new Option("所有部门","");
var comp = document.form_com_dep.compid.value ;
var i=0;
for (i=0;i < <%=depAll.length%> ; i++) {
if (bm[i][0] == comp ) {
document.form_com_dep.deptid.options[document.form_com_dep.deptid.length] = new Option(bm[i][2], bm[i][1]);
}
}
}
</script>
posted on 2006-05-14 13:05
Stellar.He 阅读(1825)
评论(0) 编辑 收藏