var nSubtopics;
var nTopics;
var aTopicText;
var aTopicValue;
var aSubtopicText;
var aSubtopicValue;
var nSelectedTopic;
var nSelectedSubtopic;
funkcja OnInitial ()
{
//debugger; ;
var i, j, n, strTopic, strSubtopic;
nTopics =document.getElementById ("_ctl0_ContentPlaceHolder1_ddlTopic") .options.length;
aTopicText = nowy Szyk (nTopics);
aTopicValue = nowy Szyk (nTopics);
dla (i=0; i< nTopics; 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 = nowy Szyk (nSubtopics);
aSubtopicValue = nowy Szyk (nSubtopics);
dla (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;
jeżeli (nSelectedTopic == (0)) {
document.getElementById ("_ctl0_ContentPlaceHolder1_ddlSubtopic") .options.length = (1);
}
inny {
strTopic = document.getElementById ("_ctl0_ContentPlaceHolder1_ddlTopic") .options [nSelectedTopic] .text;
n = strTopic.length;
j = (0);
dla (i = (1); i < nSubtopics; i++) {
strSubtopic = aSubtopicValue [i];
jeżeli (strTopic! = strSubtopic.substring ((0), n))
{
document.getElementById ("_ctl0_ContentPlaceHolder1_ddlSubtopic") .options [i - j] = null;
j++;
}
}
}
}
funkcja OnChangeTopic ()
{var i, j, n, strTopic, strSubtopic, strSubtopicVal;
jeżeli (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);
jeżeli (nSelectedTopic! = (0))
{
j = (1);
n = strTopic.length;
dla (i = (1); i < nSubtopics; i++)
{
//strSubtopic = aSubtopicValue [i];
strSubtopic = aSubtopicText [i];
strSubtopicVal = aSubtopicValue [i];
jeżeli (strTopic == strSubtopic.substring ((0), n))
{
document.getElementById ("_ctl0_ContentPlaceHolder1_ddlSubtopic") .options [j] = nowy Opcja (strSubtopic.substring (n + (1), strSubtopic.length), strSubtopicVal);
jeżeli (nSelectedSubtopic == i) {
document.getElementById ("_ctl0_ContentPlaceHolder1_ddlSubtopic") .selectedIndex = j;
}
j++;
}
}
}
}
}
funkcja OnChangeSubtopic ()
{var i, n, strSubtopic;
n = document.getElementById ("_ctl0_ContentPlaceHolder1_ddlSubtopic") .selectedIndex;
jeżeli (n == (0))
{
nSelectedSubtopic = (0);
}
inny
{
strSubtopic = document.getElementById ("_ctl0_ContentPlaceHolder1_ddlSubtopic") [n] .value;
dla (i = (1); i < nSubtopics; i++)
{
jeżeli (strSubtopic == aSubtopicValue [i])
{
nSelectedSubtopic = i;
przerwa;
}
}
}
}
|