Private myGroupData,myDCform,myCombo1Name,myCombo2Name,myFirstType,mySecType Private mylvzf,str,f1,f2,cs Private myDC1Name,myDC2Name,myList1value,myList2value Private HaveErr,Do_Tmp Private Sub Class_Initialize() HaveErr=False myGroupData="" myDCform="" myDC1Name="" myDC2Name="" myList1value="" myList2value="" myCombo1Name="" myCombo2Name="" Do_Tmp="" End Sub Public Sub Clear() HaveErr=False End Sub Private Sub Class_Terminate() Clear() myGroupData="" myDCform="" myDC1Name="" myDC2Name="" myList1value="" myList2value="" myCombo1Name="" myCombo2Name="" Do_Tmp="" End Sub Public Property Let GroupData(value) myGroupData=value myGroupData=lvzf(myGroupData) End Property Public Property Let DCform(value) myDCform=value myDCform=lvzf(myDCform) End Property Public Property Let Combo1Name(value) myCombo1Name=value End Property Public Property Let Combo2Name(value) myCombo2Name=value End Property Public Property Let DC1Name(value) myDC1Name=value End Property Public Property Let DC2Name(value) myDC2Name=value End Property Public Property Let List1value(value) myList1value=value End Property Public Property Let List2value(value) myList2value=value End Property Public Function lvzf(mylvzf) mylvzf=replace(mylvzf," ","") mylvzf=replace(mylvzf,"(","") mylvzf=replace(mylvzf,")","") mylvzf=replace(mylvzf,"'","") mylvzf=replace(mylvzf,"“","") mylvzf=replace(mylvzf,"”","") lvzf=mylvzf End Function Public Function GetArray(str,f1,f2) Dim i,x,y,tmp_a,tmp_b,a,b tmp_a=split(str,f1) x=ubound(tmp_a)-1 For i=0 To x tmp_b=split(tmp_a(i),f2) If ubound(tmp_b)>=y Then y=ubound(tmp_b) Next ReDim Result(x,y) For a=0 To x ReDim tmp_b(y) tmp_b=split(tmp_a(a),f2) If ubound(tmp_b)<>y Then HaveErr=True : Exit Function For b=0 To y Result(a,b)=tmp_b(b) Next Next GetArray=Result End Function Public Function GetGroup(ArrayTmp) Dim i,ii,iii,j,k,NoCF,FirstType_Temp ReDim PubTmp(Ubound(ArrayTmp,1)) For i=0 To Ubound(ArrayTmp,1) NoCF=True If i=0 Then PubTmp(i)=ArrayTmp(0,0):FirstType_Temp=ArrayTmp(0,0) For j=0 To i If PubTmp(j)=ArrayTmp(i,0) Then NoCF=False Next If NoCF=True Then FirstType_Temp=FirstType_Temp&"|"&ArrayTmp(i,0) : PubTmp(i)=ArrayTmp(i,0) Next myFirstType=Split(FirstType_Temp,"|") ReDim Result(Ubound(myFirstType),Ubound(ArrayTmp,1)+1) For ii=0 To Ubound(myFirstType) Result(ii,0)=myFirstType(ii) k=0 j=0 NoCF=True For iii=0 to Ubound(ArrayTmp,1) If ArrayTmp(iii,0)=myFirstType(ii) Then For j=0 to k If Result(ii,j)=ArrayTmp(iii,1) Then NoCF=False Next If NoCF=True Then k=k+1 : Result(ii,k)=ArrayTmp(iii,1) End If Next Next GetGroup=Result End Function Public Function ReturnDo() Dim i,k,m,n Dim Array_Temp Array_Temp=GetArray(myGroupData,"$","|") If HaveErr=True Then ReturnDo="GroupData数据格式有误(注意大分割符$小分割符|)" : Exit Function mySecType=GetGroup(Array_Temp) Do_Tmp=Do_Tmp&myDC1Name&"<select name="""&myCombo1Name&""" size=""1"" onChange="""&myDCform&"redirect(this.options.selectedIndex)"">"&vbcrlf For i=0 To Ubound(myFirstType) Do_Tmp=Do_Tmp&"<option value="""&split(myFirstType(i),",")(0)&""">"&split(myFirstType(i),",")(1)&"</option>"&vbcrlf Next Do_Tmp=Do_Tmp&"</select>"&vbcrlf Do_Tmp=Do_Tmp&myDC2Name&"<select name="""&myCombo2Name&""" size=""1"">"&vbcrlf For i=1 To Ubound(mySecType,2) If mySecType(0,i)<>"" Then Do_Tmp=Do_Tmp&"<option value="""&split(mySecType(0,i),",")(0)&""">"&split(mySecType(0,i),",")(1)&"</option>"&vbcrlf Next Do_Tmp=Do_Tmp&"</select>"&vbcrlf Do_Tmp=Do_Tmp&"<script>"&vbcrlf Do_Tmp=Do_Tmp&"var "&myDCform&"groups=document."&myDCform&"."&myCombo1Name&".options.length"&vbcrlf Do_Tmp=Do_Tmp&" var "&myDCform&"group=new Array("&myDCform&"groups)"&vbcrlf Do_Tmp=Do_Tmp&"for (i=0; i<"&myDCform&"groups; i++)"&vbcrlf Do_Tmp=Do_Tmp&""&myDCform&"group[i]=new Array()"&vbcrlf For m=0 To Ubound(myFirstType) n=1 k=-1 Do While n<UBound(mySecType,2) If mySecType(m,n)<>"" Then k=k+1 : Do_Tmp=Do_Tmp& ""&myDCform&"group["&m&"]["&k&"]=new Option("""&split(mySecType(m,n),",")(1)&""","""&split(mySecType(m,n),",")(0)&""")"&vbcrlf n=n+1 Loop Next Do_Tmp=Do_Tmp&"var "&myDCform&"temp=document."&myDCform&"."&myCombo2Name&""&vbcrlf Do_Tmp=Do_Tmp&"function "&myDCform&"redirect("&myDCform&"x){"&vbcrlf Do_Tmp=Do_Tmp&"for ("&myDCform&"m="&myDCform&"temp.options.length-1;"&myDCform&"m>0;"&myDCform&"m--)"&vbcrlf Do_Tmp=Do_Tmp&""&myDCform&"temp.options["&myDCform&"m]=null"&vbcrlf Do_Tmp=Do_Tmp&"for (i=0;i<"&myDCform&"group["&myDCform&"x].length;i++){"&vbcrlf Do_Tmp=Do_Tmp&""&myDCform&"temp.options[i]=new Option("&myDCform&"group["&myDCform&"x][i].text,"&myDCform&"group["&myDCform&"x][i].value)"&vbcrlf Do_Tmp=Do_Tmp&" }"&vbcrlf Do_Tmp=Do_Tmp&""&myDCform&"temp.options[0].selected=true"&vbcrlf Do_Tmp=Do_Tmp&" }"&vbcrlf Do_Tmp=Do_Tmp&" </script>"&vbcrlf If HaveErr=True Then ReturnDo="GroupData数据格式有误(注意大分割符$小分割符|)" Else ReturnDo=Do_Tmp End If End Function End Class %>