<html>
<head>
<title>
下拉列表关联
</title>
<meta http-equiv="content_type";content="text/html";charset="gb2312">
<meta name="aenweater"; content="editplus">
</head>
<script language="javascript">
<!--
var types="家电,服饰,家具,日用";
var sub_types_str="电视机,洗衣机,电冰箱,空调/外套,衬衣,大衣,裤子/外套,衬衣,大衣,裤子/清洁,洗发,纸品,橱具";
var types_ids_str="0,1,2,3";
var subtype_ids_str="001,002,003,004/101,102,103,104/201,202,203,204/301,302,303,304";
var the_split1=",";
var the_split2="/";
var goods_types=types.split(the_split1);
var type_ids=type_ids_str.split(the_split1);
var sub_types=sub_types_str.split(the_split2);
var subtypes_ids=subtype_ids_str.split(the_split2);
function select( )
{
with(document.goods.gtype)
{
var type_sel=options[selectedindex].text;
}
for(var i=0;i<goods_types.length;i++)
{
if(goods_types[i]==type_sel)
{
var now_subtypes=sub_types[i].split(the_split);
var now_subtype_ids=subtypes_ids[i].split(the_split);
document.goods.gsub_type.options.length=0;
document.goods.gsub_type.options.length=now_subtypes.length;
with(document.all.goods.gsub_type)
{ for(var j=0;j<now_subtypes.length;j++)
{
option[j].text=now_subtypes[j]
option[j].value=now_subtype_ids[j];
}
}
break;
}
}
}
function initial_select()
{
document.goods.gtype.length=goods_types.length;
with(document.goods.gtype)
{
for(var i=0;i<goods_types.length;i++)
{ option[i].text=goods_types[i];
option[i].value=type_ids[i];
}
options[selectedindex].text=goods_types[0];
options[selectedindex].value=type_ids[0];
}
var now_subtypes2=sub_types[0].split(the_split1);
var now_subtype_ids2=subtypes_ids[0].split(the_split1);
document.goods.gsub_type.options.length=now_subtypes2.length;
with(document.goods.gsub_type)
{
for(var j=0;j<now_subtypes2.length;j++)
{ options[j].text=now_subtypes2[j];
options[j].value=now_subtype_ids2[j];
}
//-->
</script>
<body>
<form name="goods">
<select name="gtype" onchange="select()"type="text" type="width:100">
</select>
<select type="text"name="gsub_type" type="width:100">
</select></form>
<script language="javascript">
<!--
initial_select();
// -->
</script>
</body>
</html>
<head>
<title>
下拉列表关联
</title>
<meta http-equiv="content_type";content="text/html";charset="gb2312">
<meta name="aenweater"; content="editplus">
</head>
<script language="javascript">
<!--
var types="家电,服饰,家具,日用";
var sub_types_str="电视机,洗衣机,电冰箱,空调/外套,衬衣,大衣,裤子/外套,衬衣,大衣,裤子/清洁,洗发,纸品,橱具";
var types_ids_str="0,1,2,3";
var subtype_ids_str="001,002,003,004/101,102,103,104/201,202,203,204/301,302,303,304";
var the_split1=",";
var the_split2="/";
var goods_types=types.split(the_split1);
var type_ids=type_ids_str.split(the_split1);
var sub_types=sub_types_str.split(the_split2);
var subtypes_ids=subtype_ids_str.split(the_split2);
function select( )
{
with(document.goods.gtype)
{
var type_sel=options[selectedindex].text;
}
for(var i=0;i<goods_types.length;i++)
{
if(goods_types[i]==type_sel)
{
var now_subtypes=sub_types[i].split(the_split);
var now_subtype_ids=subtypes_ids[i].split(the_split);
document.goods.gsub_type.options.length=0;
document.goods.gsub_type.options.length=now_subtypes.length;
with(document.all.goods.gsub_type)
{ for(var j=0;j<now_subtypes.length;j++)
{
option[j].text=now_subtypes[j]
option[j].value=now_subtype_ids[j];
}
}
break;
}
}
}
function initial_select()
{
document.goods.gtype.length=goods_types.length;
with(document.goods.gtype)
{
for(var i=0;i<goods_types.length;i++)
{ option[i].text=goods_types[i];
option[i].value=type_ids[i];
}
options[selectedindex].text=goods_types[0];
options[selectedindex].value=type_ids[0];
}
var now_subtypes2=sub_types[0].split(the_split1);
var now_subtype_ids2=subtypes_ids[0].split(the_split1);
document.goods.gsub_type.options.length=now_subtypes2.length;
with(document.goods.gsub_type)
{
for(var j=0;j<now_subtypes2.length;j++)
{ options[j].text=now_subtypes2[j];
options[j].value=now_subtype_ids2[j];
}
//-->
</script>
<body>
<form name="goods">
<select name="gtype" onchange="select()"type="text" type="width:100">
</select>
<select type="text"name="gsub_type" type="width:100">
</select></form>
<script language="javascript">
<!--
initial_select();
// -->
</script>
</body>
</html>
我在线等,,,,,,
其他的不知道为什么显示不出来?