<%@ page import="javautilDateyavafileapp*javasql*;"
contentType="text/html;charset=GB" pageEncoding="GB"
%>
<style>
f{ fontsize:pt; }
bgc{ backgroundcolor:#AECAF; color: #FF }
buttons{fontfamily:Arial; fontsize:px; fontweight:bold; backgroundcolor:#E; color:white; bordertop: solid px #AACAFB;
borderbottom: solid px #EDC;
borderleft: solid px #AECAF;
borderright: solid px #BD;
padding:px;
margin:px;}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!
function rv()
{
var val="";
for(i=;i<combo_boxlistlength;i++){
val+=""+combo_boxlist[i]value;
}
if(valcharAt()==""){
val=valsubstr(vallength);
}
openerformfrecnamevalue=val;
selfclose();
}
//>
</SCRIPT>
<body leftmargin="" topmargin="" marginwidth="" marginheight="">
<jsp:useBean id="user" scope="session" class="yavafileappUserBean" />
<%
CDataSource ds=new CDataSource(); //数据联结Bean实例
javasqlConnection conn=dsgetConnection();
javasqlStatement stmt=null;
javasqlResultSet rs=null;
CDataCheck dc=new CDataCheck();
%>
<%
String sqlu="SELECT tfno tfname tfname AS fdept FROM tuser t LEFT OUTER JOIN TDept t ON tfdept = tfno order by tfname";
stmt=conncreateStatement();
rs=stmtexecuteQuery(sqlu);
%>
<script language=Javascript>
arr = new Array();
<% int temp=;
while(rsnext())
{
%>
arr[<%=temp%>]=new Array("<%=rsgetString("fname")%>""<%=rsgetString("fdept")%>");
<%
temp = temp + ;
}
%>
temp=<%=temp%>;
function ChangeLocation(id){
documentcombo_boxcitylength=; //初始化第级菜单的长度下标从开始
var i = ;
documentcombo_boxcityoptions[]=new Option();
for(i=;i<temp;i++){
if(arr[i][]==id){//如果相等证明在第级里面有输入第级组织的子集arr[总数目][部门]
documentcombo_boxcityoptions[documentcombo_boxcitylength] = new Option(arr[i][] arr[i][]);
}
}
}
</script>
<form name="combo_box">
<table border="" cellspacing="" cellpadding="" height="" width="">
<tr height="">
<td bgcolor="#" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
<td bgcolor="#" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
<td bgcolor="#" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
<td bgcolor="#" class="buttons" align=center><font color=#ffffff>最终人</font></td>
</tr>
<tr>
<td>
<select multiple id=prov name="prov" onchange="ChangeLocation(combo_boxprovoptions[combo_boxprovselectedIndex]text);" style="width:;height:" class="bgc">
<option value="">请选择部门 ></option>
<%
String sqld="SELECT * FROM tdept";
stmt=conncreateStatement();
rs=stmtexecuteQuery(sqld);
while(rsnext())
{
%>
<option name="<%=rsgetString("fno")%>"><%=rsgetString("fname")%></option>
<%
}
%>
</select>
</td>
<td>
<select multiple id=city style="width:;height:" class="bgc">
</select>
</td>
<td nowrap align="center" class="bgc">
<input type="button" onClick="move(thisformlistthisformcity)" value="<<" class="buttons">
<input type="button" onClick="move(thisformcitythisformlist)" value=">>" class="buttons">
</td>
<td>
<select multiple size="" name="list" style="width:;height:" class="bgc">
</select>
</td>
</tr>
<tr class="bgc">
<td colspan="" align="center"><input type="button" name="button" class="buttons" value="选好了!" onclick="rv();"></td>
</tr>
</table>
</form>
<script language="JavaScript">
//人名移动
function move(fbox tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for (i = ; i < tboxoptionslength; i++) {
arrLookup[tboxoptions[i]text] = tboxoptions[i]value;
arrTbox[i] = tboxoptions[i]text;
}
var fLength = ;
var tLength = arrTboxlength;
for(i = ; i < fboxoptionslength; i++) {
arrLookup[fboxoptions[i]text] = fboxoptions[i]value;
if (fboxoptions[i]selected && fboxoptions[i]value != "") {
arrTbox[tLength] = fboxoptions[i]text;
tLength++;
}
else {
arrFbox[fLength] = fboxoptions[i]text;
fLength++;
}
}
arrFboxsort();
arrTboxsort();
fboxlength = ;
tboxlength = ;
var c;
for(c = ; c < arrFboxlength; c++) {
var no = new Option();
novalue = arrLookup[arrFbox[c]];
notext = arrFbox[c];
fbox[c] = no;
}
for(c = ; c < arrTboxlength; c++) {
var no = new Option();
novalue = arrLookup[arrTbox[c]];
notext = arrTbox[c];
tbox[c] = no;
}
}
</script>
</body>