Menu <%
'****************************************
' Class Name: Double Linkage Menu Class
'****************************************
' This class is originally written by [71port]sean, [71port]80 Port]
' [Arisisi] modify and perfect bugs, no copyright, arbitrary transcription, attention to complete
' Public release on December 10, 2005
' Welcome to Http://www.71port.com, Arisisi Web development
' Dim DC
' Set DC =new Dcombo
' DC. Groupdata= "GD, Guangdong Province | GZ, Guangzhou $gd, Guangdong province | DG, Dongguan $gx, Guangxi |nn, Nanning $gd, Guangdong province | SS, Shenzhen $ "
' Variable data format = ' first list value, name | Second list value, name $ first list value, name | Second list value, name $ '
' DC. Dcform= the name of the "frm" form to be unique
' DC. Dc1name= "First list" ' First list ' name
' DC. Dc2name= the name of the second list of "first list"
' Dc.combo1name= ' ComboName1 ' The name of the first list
' Dc.combo2name= ' ComboName2 ' The name of the second list
' Response. Write DC. Returndo
' Set dc=nothing
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 Data format error (note large split $ small split |)": 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 Data format error (note large split $ small separator |)"
Else
Returndo=do_tmp
End If
End Function
End Class
%>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service