就是这段程序了,愁死我了!
<script language="javascript" type="text/javascript">
var hw_selecttext ="<%=msg%>"
//如果文本与值不同,请输入在文本后加上@值,如:北京@010|东城@001^西城@002
var TheSplit1 = "*" //北京与上海的分隔符
var TheSplit2 = "|" //北京与东城的分隔符
var TheSplit3 = "^" //东城与西城的分隔符
var TheSplit4 = "@" //文本与值的分隔符,可以省略
var hwallselecttext = hw_selecttext
var hwdefault_value = "山东济宁"
//默认值,在值有相同时有bug。
document.write('<select name="hw_1" onChange = "hw_select()" dataType="Require" msg="请选择大分类"></select> <select name="hw_2" onChange = "hw_select()" dataType="Require" msg="请选择小分类"></select>\n');
var hwallselecttextarr
hwallselecttextarr = hwallselecttext.split(TheSplit1);
hwArraylength = hwallselecttextarr.length;
var hwwhere = new Array(hwArraylength);
hwwhere[0]= new hw_comefrom("请选择@","请选择@"
;
for (var hwl=0;hwl<hwArraylength;hwl++)
{
eval(hwwhere[hwl+1] = new hw_comefrom(hwallselecttextarr[hwl].split(TheSplit2)[0],hwallselecttextarr[hwl].split(TheSplit2)[1]))
}
function hw_comefrom(hwSelect_s1,hwSelect_s2) { this.hwSelect_s1 = hwSelect_s1; this.hwSelect_s2 = hwSelect_s2; }
function hw_select()
{
with(document.all.hw_1)
{
var hwSelect_s12 = options[selectedIndex].value;
}
for(hwi = 0;hwi hwwhere.length;hwi ++)
{
if (hwwhere[hwi].hwSelect_s1.indexOf(TheSplit4)!=-1)
{
var hwThisV = hwwhere[hwi].hwSelect_s1.split(TheSplit4)[1];
}
else
{
var hwThisV = hwwhere[hwi].hwSelect_s1;
}
if (hwThisV == hwSelect_s12)
{
hwSelect_s13 = (hwwhere[hwi].hwSelect_s2).split(TheSplit3);
for(hwj = 0;hwj hwSelect_s13.length;hwj++)
{
with(document.all.hw_2)
{
length = hwSelect_s13.length;
if (hwSelect_s13[hwj].indexOf(TheSplit4)!=-1)
{
options[hwj].text = hwSelect_s13[hwj].split(TheSplit4)[0];
options[hwj].value = hwSelect_s13[hwj].split(TheSplit4)[1];
}
else
{
options[hwj].text = hwSelect_s13[hwj];
options[hwj].value = hwSelect_s13[hwj];
}
var hwSelect_s14=options[selectedIndex].value;
}
}
break;
}
}
//document.all.hw.value=hwSelect_s12+""+hwSelect_s14;
}
function hw_init()
{
with(document.all.hw_1)
{
length = hwwhere.length;
var hwm = 0
for(hwk=0;hwk<hwwhere.length;hwk++)
{
if (hwwhere[hwk].hwSelect_s1.indexOf(TheSplit4)!=-1)
{
options[hwk].text = hwwhere[hwk].hwSelect_s1.split(TheSplit4)[0];
options[hwk].value = hwwhere[hwk].hwSelect_s1.split(TheSplit4)[1];
if (hwdefault_value.indexOf(hwwhere[hwk].hwSelect_s1.split(TheSplit4)[1])!=-1){hwm = hwk}
}
else
{
options[hwk].text = hwwhere[hwk].hwSelect_s1;
options[hwk].value = hwwhere[hwk].hwSelect_s1;
if (hwdefault_value.indexOf(hwwhere[hwk].hwSelect_s1)!=-1){hwm = hwk}
}
}
selectedIndex = hwm
}
with(document.all.hw_2)
{
var hwn = 0
hwSelect_s13 = (hwwhere[hwm].hwSelect_s2).split(TheSplit3);
length = hwSelect_s13.length;
for(hwl=0;hwllength;hwl++)
{
if (hwSelect_s13[hwl].indexOf(TheSplit4)!=-1)
{
options[hwl].text = hwSelect_s13[hwl].split(TheSplit4)[0];
options[hwl].value = hwSelect_s13[hwl].split(TheSplit4)[1];
if (hwdefault_value.indexOf(hwSelect_s13[hwl].split(TheSplit4)[1])!=-1){hwn = hwl}
}
else
{
options[hwl].text = hwSelect_s13[hwl];
options[hwl].value = hwSelect_s13[hwl];
if (hwdefault_value.indexOf(hwSelect_s13[hwl])!=-1){hwn = hwl}
}
}
selectedIndex = hwn
}
}
hw_init();
</script>