class= " lineNumbers "
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
|
class=
nSubtopics " class= " id= " codeSnippet789709 var;
nTopics var;
aTopicText var;
aTopicValue var;
aSubtopicText var;
aSubtopicValue var;
var nSelectedTopic;
var nSelectedSubtopic;
функция OnInitial ()
{
//debugger; ;
var iий, j, n, strTopic, strSubtopic;
nTopics =document.getElementById («_ctl0_ContentPlaceHolder1_ddlTopic») .options.length;
aTopicText = новый блок (nTopics);
aTopicValue = новый блок (nTopics);
для (i=0; nTopics i<; i++)
{
aTopicText [I] = document.getElementById («_ctl0_ContentPlaceHolder1_ddlTopic») .options [I] .text;
aTopicValue [I] = document.getElementById («_ctl0_ContentPlaceHolder1_ddlTopic») .options [I] .value;
}
nSubtopics = document.getElementById («_ctl0_ContentPlaceHolder1_ddlSubtopic») .options.length;
aSubtopicText = новый блок (nSubtopics);
aSubtopicValue = новый блок (nSubtopics);
для (I = 0; iий < nSubtopics; i++) {
aSubtopicText [I] = document.getElementById («_ctl0_ContentPlaceHolder1_ddlSubtopic») .options [I] .text;
aSubtopicValue [I] = document.getElementById («_ctl0_ContentPlaceHolder1_ddlSubtopic») .options [I] .value;
}
nSelectedTopic = document.getElementById («_ctl0_ContentPlaceHolder1_ddlTopic») .selectedIndex;
nSelectedSubtopic = document.getElementById («_ctl0_ContentPlaceHolder1_ddlSubtopic») .selectedIndex;
если (nSelectedTopic == 0) {, то
document.getElementById («_ctl0_ContentPlaceHolder1_ddlSubtopic») .options.length = 1;
}
еще {
strTopic = document.getElementById («_ctl0_ContentPlaceHolder1_ddlTopic») .options [nSelectedTopic] .text;
n = strTopic.length;
j = 0;
для (I = 1; iий < nSubtopics; i++) {
strSubtopic = aSubtopicValue [I];
если (strTopic! = strSubtopic.substring (0, n))
{
document.getElementById («_ctl0_ContentPlaceHolder1_ddlSubtopic») .options [I - j] = null;
j++;
}
}
}
}
функция OnChangeTopic ()
{var iий, j, n, strTopic, strSubtopic, strSubtopicVal;
если (nSelectedTopic! = document.getElementById («_ctl0_ContentPlaceHolder1_ddlTopic») .selectedIndex)
{
nSelectedTopic = document.getElementById («_ctl0_ContentPlaceHolder1_ddlTopic») .selectedIndex;
strTopic = document.getElementById («_ctl0_ContentPlaceHolder1_ddlTopic») [nSelectedTopic] .text;
document.getElementById («_ctl0_ContentPlaceHolder1_ddlSubtopic») .options.length = 1;
если (nSelectedTopic! = 0)
{
j = 1;
n = strTopic.length;
для (I = 1; iий < nSubtopics; i++)
{
//strSubtopic = aSubtopicValue [I];
strSubtopic = aSubtopicText [I];
strSubtopicVal = aSubtopicValue [I];
если (strTopic == strSubtopic.substring, то (0, n))
{
document.getElementById («_ctl0_ContentPlaceHolder1_ddlSubtopic») .options [j] = новый вариант (strSubtopic.substring (n + 1, strSubtopic.length), strSubtopicVal);
если (nSelectedSubtopic == iий) {, то
document.getElementById («_ctl0_ContentPlaceHolder1_ddlSubtopic») .selectedIndex = j;
}
j++;
}
}
}
}
}
функция OnChangeSubtopic ()
{var iий, n, strSubtopic;
n = document.getElementById («_ctl0_ContentPlaceHolder1_ddlSubtopic») .selectedIndex;
если (== 0 n), то
{
nSelectedSubtopic = 0;
}
еще
{
strSubtopic = document.getElementById («_ctl0_ContentPlaceHolder1_ddlSubtopic») [n] .value;
для (I = 1; iий < nSubtopics; i++)
{
если (strSubtopic aSubtopicValue, то == [I])
{
nSelectedSubtopic = I;
пролом;
}
}
}
}
|