下面脚本是三级关联,但我想实现在secondChoice进行onchange时,thirdChoice1,thirdChoice2,thirdChoice3出现一样的可选内容,另外若需要选择thirdChoice1,thirdChoice2,thirdChoice3等值时,不能出现相同内容<SCRIPT LANGUAGE="JavaScript">
var arrItems1 = new Array();
var arrItemsGrp1 = new Array();
//firstChoice.value=1
arrItems1[11] = "基本信息";
arrItemsGrp1[11] = 1;
arrItems1[12] = "土地信息";
arrItemsGrp1[12] = 1;
arrItems1[13] = "价格信息";
arrItemsGrp1[13] = 1;
//firstChoice.value=2
arrItems1[21] = "基本信息";
arrItemsGrp1[21] = 2;
arrItems1[22] = "房产信息";
arrItemsGrp1[22] = 2;
arrItems1[23] = "价格信息";
arrItemsGrp1[23] = 2;
//firstChoice.value=3
arrItems1[31] = "基本信息";
arrItemsGrp1[31] = 3;
arrItems1[32] = "土地信息";
arrItemsGrp1[32] = 3;
arrItems1[33] = "房产信息";
arrItemsGrp1[33] = 3;
arrItems1[34] = "价格信息";
arrItemsGrp1[34] = 3; var arrItems2 = new Array();
var arrItemsGrp2 = new Array();
//firstChoice.value=1&&基本信息
arrItems2[111] = "区域";
arrItemsGrp2[111] = 11
arrItems2[112] = "地址";
arrItemsGrp2[112] = 11
arrItems2[113] = "周边状况";
arrItemsGrp2[113] = 11
arrItems2[114] = "来源";
arrItemsGrp2[114] = 11
//firstChoice.value=1&&土地信息
arrItems2[121] = "面积";
arrItemsGrp2[121] = 12
arrItems2[122] = "等级";
arrItemsGrp2[122] = 12
arrItems2[123] = "用途";
arrItemsGrp2[123] = 12
arrItems2[124] = "期限";
arrItemsGrp2[124] = 12
arrItems2[125] = "容积率";
arrItemsGrp2[125] = 12
arrItems2[126] = "权属";
arrItemsGrp2[126] = 12
//firstChoice.value=1&&价格信息
arrItems2[131] = "价格定义";
arrItemsGrp2[131] = 13
arrItems2[132] = "时间";
arrItemsGrp2[132] = 13
arrItems2[133] = "单价";
arrItemsGrp2[133] = 13
arrItems2[134] = "总价";
arrItemsGrp2[134] = 13//firstChoice.value=2&&基本信息
arrItems2[211] = "区域";
arrItemsGrp2[211] = 21
arrItems2[212] = "地址";
arrItemsGrp2[212] = 21
arrItems2[213] = "周边状况";
arrItemsGrp2[213] = 21
arrItems2[214] = "来源";
arrItemsGrp2[214] = 21
//firstChoice.value=2&&房产信息
arrItems2[221] = "面积";
arrItemsGrp2[221] = 22
arrItems2[222] = "层数";
arrItemsGrp2[222] = 22
arrItems2[223] = "结构";
arrItemsGrp2[223] = 22
arrItems2[224] = "标准";
arrItemsGrp2[224] = 22
arrItems2[225] = "建造年代";
arrItemsGrp2[225] = 22
arrItems2[226] = "用途";
arrItemsGrp2[226] = 22
arrItems2[227] = "权属";
arrItemsGrp2[227] = 22
//firstChoice.value=2&&价格信息
arrItems2[231] = "价格定义";
arrItemsGrp2[231] = 23
arrItems2[232] = "时间";
arrItemsGrp2[232] = 23
arrItems2[233] = "单价";
arrItemsGrp2[233] = 23
arrItems2[234] = "总价";
arrItemsGrp2[234] = 23
//firstChoice.value=3&&基本信息
arrItems2[311] = "区域";
arrItemsGrp2[311] = 31
arrItems2[312] = "地址";
arrItemsGrp2[312] = 31
arrItems2[313] = "周边状况";
arrItemsGrp2[313] = 31
arrItems2[314] = "来源";
arrItemsGrp2[314] = 31
//firstChoice.value=3&&土地信息
arrItems2[321] = "面积";
arrItemsGrp2[321] = 32
arrItems2[322] = "等级";
arrItemsGrp2[322] = 32
arrItems2[323] = "用途";
arrItemsGrp2[323] = 32
arrItems2[324] = "期限";
arrItemsGrp2[324] = 32
arrItems2[325] = "容积率";
arrItemsGrp2[325] = 32
arrItems2[326] = "权属";
arrItemsGrp2[326] = 32
//firstChoice.value=3&&房产信息
arrItems2[331] = "面积";
arrItemsGrp2[331] = 33
arrItems2[332] = "层数";
arrItemsGrp2[332] = 33
arrItems2[333] = "结构";
arrItemsGrp2[333] = 33
arrItems2[334] = "标准";
arrItemsGrp2[334] = 33
arrItems2[335] = "建造年代";
arrItemsGrp2[335] = 33
arrItems2[336] = "用途";
arrItemsGrp2[336] = 33
arrItems2[337] = "权属";
arrItemsGrp2[337] = 33
//firstChoice.value=3&&价格信息
arrItems2[341] = "价格定义";
arrItemsGrp2[341] = 34
arrItems2[342] = "时间";
arrItemsGrp2[342] = 34
arrItems2[343] = "单价";
arrItemsGrp2[343] = 34
arrItems2[344] = "总价";
arrItemsGrp2[344] = 34
function selectChange(control, controlToPopulate, ItemArray, GroupArray)
{
var myEle ;
var x ;
// Empty the second drop down box of any choices
for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
if (control.name == "firstChoice") {
// Empty the third drop down box of any choices
for (var q=myChoices.thirdChoice1.options.length;q>=0;q--) myChoices.thirdChoice1.options[q] = null;
}
// ADD Default Choice - in case there are no values
myEle = document.createElement("option") ;
myEle.value = 0 ;
myEle.text = "未指定条件" ;
controlToPopulate.add(myEle) ;
// Now loop through the array of individual items
// Any containing the same child id are added to
// the second dropdown box
for ( x = 11 ; x < ItemArray.length ; x++ )
{
if ( GroupArray[x] == control.value )
{
myEle = document.createElement("option") ;
myEle.value = x ;
myEle.text = ItemArray[x] ;
controlToPopulate.add(myEle) ;
}
}
}
// End -->
</script>
<form name="myChoices" method="POST" action="/realestate/lookappraisalreportquery.asp" onsubmit="return checkinfo();">
<table border="0" cellspacing="0" width="760" cellpadding="0" style="border-collapse: collapse" align="center">
<tr><td width="630" align="left" height="40">查询条件:<select name="assessobject"><option>评估对象</option></select>
<SELECT id="firstChoice" name="firstChoice" onchange="selectChange(this, myChoices.secondChoice, arrItems1, arrItemsGrp1);">
<option selected value="0">未指定对象</option>
<option value="1">土地</option>
<option value="2">房产</option>
<option value="3">房地产</option>
</SELECT>
<SELECT id="secondChoice" name="secondChoice" onchange="selectChange(this, myChoices.thirdChoice1, arrItems2, arrItemsGrp2);"></SELECT>
<SELECT id="thirdChoice1" name="thirdChoice1"></SELECT>
<SELECT id="thirdChoice2" name="thirdChoice2"></SELECT>
<SELECT id="thirdChoice3" name="thirdChoice3"></SELECT>
</form>
var arrItems1 = new Array();
var arrItemsGrp1 = new Array();
//firstChoice.value=1
arrItems1[11] = "基本信息";
arrItemsGrp1[11] = 1;
arrItems1[12] = "土地信息";
arrItemsGrp1[12] = 1;
arrItems1[13] = "价格信息";
arrItemsGrp1[13] = 1;
//firstChoice.value=2
arrItems1[21] = "基本信息";
arrItemsGrp1[21] = 2;
arrItems1[22] = "房产信息";
arrItemsGrp1[22] = 2;
arrItems1[23] = "价格信息";
arrItemsGrp1[23] = 2;
//firstChoice.value=3
arrItems1[31] = "基本信息";
arrItemsGrp1[31] = 3;
arrItems1[32] = "土地信息";
arrItemsGrp1[32] = 3;
arrItems1[33] = "房产信息";
arrItemsGrp1[33] = 3;
arrItems1[34] = "价格信息";
arrItemsGrp1[34] = 3; var arrItems2 = new Array();
var arrItemsGrp2 = new Array();
//firstChoice.value=1&&基本信息
arrItems2[111] = "区域";
arrItemsGrp2[111] = 11
arrItems2[112] = "地址";
arrItemsGrp2[112] = 11
arrItems2[113] = "周边状况";
arrItemsGrp2[113] = 11
arrItems2[114] = "来源";
arrItemsGrp2[114] = 11
//firstChoice.value=1&&土地信息
arrItems2[121] = "面积";
arrItemsGrp2[121] = 12
arrItems2[122] = "等级";
arrItemsGrp2[122] = 12
arrItems2[123] = "用途";
arrItemsGrp2[123] = 12
arrItems2[124] = "期限";
arrItemsGrp2[124] = 12
arrItems2[125] = "容积率";
arrItemsGrp2[125] = 12
arrItems2[126] = "权属";
arrItemsGrp2[126] = 12
//firstChoice.value=1&&价格信息
arrItems2[131] = "价格定义";
arrItemsGrp2[131] = 13
arrItems2[132] = "时间";
arrItemsGrp2[132] = 13
arrItems2[133] = "单价";
arrItemsGrp2[133] = 13
arrItems2[134] = "总价";
arrItemsGrp2[134] = 13//firstChoice.value=2&&基本信息
arrItems2[211] = "区域";
arrItemsGrp2[211] = 21
arrItems2[212] = "地址";
arrItemsGrp2[212] = 21
arrItems2[213] = "周边状况";
arrItemsGrp2[213] = 21
arrItems2[214] = "来源";
arrItemsGrp2[214] = 21
//firstChoice.value=2&&房产信息
arrItems2[221] = "面积";
arrItemsGrp2[221] = 22
arrItems2[222] = "层数";
arrItemsGrp2[222] = 22
arrItems2[223] = "结构";
arrItemsGrp2[223] = 22
arrItems2[224] = "标准";
arrItemsGrp2[224] = 22
arrItems2[225] = "建造年代";
arrItemsGrp2[225] = 22
arrItems2[226] = "用途";
arrItemsGrp2[226] = 22
arrItems2[227] = "权属";
arrItemsGrp2[227] = 22
//firstChoice.value=2&&价格信息
arrItems2[231] = "价格定义";
arrItemsGrp2[231] = 23
arrItems2[232] = "时间";
arrItemsGrp2[232] = 23
arrItems2[233] = "单价";
arrItemsGrp2[233] = 23
arrItems2[234] = "总价";
arrItemsGrp2[234] = 23
//firstChoice.value=3&&基本信息
arrItems2[311] = "区域";
arrItemsGrp2[311] = 31
arrItems2[312] = "地址";
arrItemsGrp2[312] = 31
arrItems2[313] = "周边状况";
arrItemsGrp2[313] = 31
arrItems2[314] = "来源";
arrItemsGrp2[314] = 31
//firstChoice.value=3&&土地信息
arrItems2[321] = "面积";
arrItemsGrp2[321] = 32
arrItems2[322] = "等级";
arrItemsGrp2[322] = 32
arrItems2[323] = "用途";
arrItemsGrp2[323] = 32
arrItems2[324] = "期限";
arrItemsGrp2[324] = 32
arrItems2[325] = "容积率";
arrItemsGrp2[325] = 32
arrItems2[326] = "权属";
arrItemsGrp2[326] = 32
//firstChoice.value=3&&房产信息
arrItems2[331] = "面积";
arrItemsGrp2[331] = 33
arrItems2[332] = "层数";
arrItemsGrp2[332] = 33
arrItems2[333] = "结构";
arrItemsGrp2[333] = 33
arrItems2[334] = "标准";
arrItemsGrp2[334] = 33
arrItems2[335] = "建造年代";
arrItemsGrp2[335] = 33
arrItems2[336] = "用途";
arrItemsGrp2[336] = 33
arrItems2[337] = "权属";
arrItemsGrp2[337] = 33
//firstChoice.value=3&&价格信息
arrItems2[341] = "价格定义";
arrItemsGrp2[341] = 34
arrItems2[342] = "时间";
arrItemsGrp2[342] = 34
arrItems2[343] = "单价";
arrItemsGrp2[343] = 34
arrItems2[344] = "总价";
arrItemsGrp2[344] = 34
function selectChange(control, controlToPopulate, ItemArray, GroupArray)
{
var myEle ;
var x ;
// Empty the second drop down box of any choices
for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
if (control.name == "firstChoice") {
// Empty the third drop down box of any choices
for (var q=myChoices.thirdChoice1.options.length;q>=0;q--) myChoices.thirdChoice1.options[q] = null;
}
// ADD Default Choice - in case there are no values
myEle = document.createElement("option") ;
myEle.value = 0 ;
myEle.text = "未指定条件" ;
controlToPopulate.add(myEle) ;
// Now loop through the array of individual items
// Any containing the same child id are added to
// the second dropdown box
for ( x = 11 ; x < ItemArray.length ; x++ )
{
if ( GroupArray[x] == control.value )
{
myEle = document.createElement("option") ;
myEle.value = x ;
myEle.text = ItemArray[x] ;
controlToPopulate.add(myEle) ;
}
}
}
// End -->
</script>
<form name="myChoices" method="POST" action="/realestate/lookappraisalreportquery.asp" onsubmit="return checkinfo();">
<table border="0" cellspacing="0" width="760" cellpadding="0" style="border-collapse: collapse" align="center">
<tr><td width="630" align="left" height="40">查询条件:<select name="assessobject"><option>评估对象</option></select>
<SELECT id="firstChoice" name="firstChoice" onchange="selectChange(this, myChoices.secondChoice, arrItems1, arrItemsGrp1);">
<option selected value="0">未指定对象</option>
<option value="1">土地</option>
<option value="2">房产</option>
<option value="3">房地产</option>
</SELECT>
<SELECT id="secondChoice" name="secondChoice" onchange="selectChange(this, myChoices.thirdChoice1, arrItems2, arrItemsGrp2);"></SELECT>
<SELECT id="thirdChoice1" name="thirdChoice1"></SELECT>
<SELECT id="thirdChoice2" name="thirdChoice2"></SELECT>
<SELECT id="thirdChoice3" name="thirdChoice3"></SELECT>
</form>
解决方案 »
- 关于页面重新加载调用COOKIES的问题
- 请教:参数无效
- 金山词霸api接口该怎么用啊?
- 帮我解析一下意思
- js自动完成功能,如何可以选择之中的多个值
- $(document) 提示 Error: Object doesn't support this property or method 都有什么可能呢?
- 框架 页面显示问题
- 关于鼠标位于table的竖线上的响应问题-100分..能回答的拿吧.
- 实现关闭时弹出一个类似word关闭时的确认框,“是否保存修改”,三个钮:是、否、取消。
- jqplot 中的shapeRenderer 画任意矩形,有知道的吗?
- select菜单问题
- javascript暂停问题
干吗这样麻烦arrItems1['']=['','',''];这样用二维数组比较方便