<script language="javascript" type="text/javascript">
<!--
var arrSubRelatingType = new Array(); //关联交易子类
<%
VOList relating_type = (VOList)request.getAttribute("typenameListrelating");
for(int i = 0; i < relating_type.count(); i++)
{
%>
arrSubRelatingType[<%=i%>] = new Array();
arrSubRelatingType[<%=i%>][0]='<%=relating_type.get(i).getString("type_id")%>';
arrSubRelatingType[<%=i%>][1]='<%=relating_type.get(i).getString("type_name")%>';
arrSubRelatingType[<%=i%>][2]='<%=relating_type.get(i).getString("group_id")%>';
<%
}
%>
// 增加一个名为 trim 的函数作为 String 构造函数的原型对象的一个方法
String.prototype.trim = function()
{
// 用正则表达式将前后空格
// 用空字符串替代。
return this.replace(/(^\s*)|(\s*$)/g, "");
}
//二级联动
function linkage(selBigID,selSmallID,tip,arrSmallClass)
{
var objL = document.getElementById(selBigID);
var obj = document.getElementById(selSmallID);
obj.length = 0;
if(tip.trim()=="") tip="-请选择-";
if(objL.selectedIndex == 0)
{
obj.options[0] = new Option(tip, "");
return;
}
var len = 0;
var bigClassId = objL.options[objL.selectedIndex].value;
var tip2 = "-无子类-";
for(var i=0; i<arrSmallClass.length; i++)
{
//alert(bigClassId +' --- '+ arrSmallClass[i][2]);
if(arrSmallClass[i][2] == bigClassId)
{
tip2 = tip;
obj.options[++len] = new Option(arrSmallClass[i][1], arrSmallClass[i][0]);
}
}
obj.options[0] = new Option(tip2, "");
}
//-->
</script>
============================================
<td height="35" align="right">关联交易大类别:</td>
<td height="35">
<select id="drpBig_relating_type" name="drpBig_relating_type" Onchange="javascript:linkage(this.id,'drpSmall_relating_type','',arrSubRelatingType);">
<option value="">-请选择-</option>
<exp:options name="drpBig_relating_type" list="groupnameListrelating" idfield="group_id" namefield="group_name" default="<%=this.value("val_big_relating","")%>" />
</select>
</td>
<td height="35" align="right">关联交易子类别:</td>
<td height="35">
<select id="drpSmall_relating_type" name="drpSmall_relating_type">
<option value="">-请选择-</option>
<exp:options name="drpSmall_relating_type" list="typenameListrelatingSub" idfield="type_id" namefield="type_name" default="<%=this.value("val_small_relating","")%>"/>
</select>
</td>
<!--
var arrSubRelatingType = new Array(); //关联交易子类
<%
VOList relating_type = (VOList)request.getAttribute("typenameListrelating");
for(int i = 0; i < relating_type.count(); i++)
{
%>
arrSubRelatingType[<%=i%>] = new Array();
arrSubRelatingType[<%=i%>][0]='<%=relating_type.get(i).getString("type_id")%>';
arrSubRelatingType[<%=i%>][1]='<%=relating_type.get(i).getString("type_name")%>';
arrSubRelatingType[<%=i%>][2]='<%=relating_type.get(i).getString("group_id")%>';
<%
}
%>
// 增加一个名为 trim 的函数作为 String 构造函数的原型对象的一个方法
String.prototype.trim = function()
{
// 用正则表达式将前后空格
// 用空字符串替代。
return this.replace(/(^\s*)|(\s*$)/g, "");
}
//二级联动
function linkage(selBigID,selSmallID,tip,arrSmallClass)
{
var objL = document.getElementById(selBigID);
var obj = document.getElementById(selSmallID);
obj.length = 0;
if(tip.trim()=="") tip="-请选择-";
if(objL.selectedIndex == 0)
{
obj.options[0] = new Option(tip, "");
return;
}
var len = 0;
var bigClassId = objL.options[objL.selectedIndex].value;
var tip2 = "-无子类-";
for(var i=0; i<arrSmallClass.length; i++)
{
//alert(bigClassId +' --- '+ arrSmallClass[i][2]);
if(arrSmallClass[i][2] == bigClassId)
{
tip2 = tip;
obj.options[++len] = new Option(arrSmallClass[i][1], arrSmallClass[i][0]);
}
}
obj.options[0] = new Option(tip2, "");
}
//-->
</script>
============================================
<td height="35" align="right">关联交易大类别:</td>
<td height="35">
<select id="drpBig_relating_type" name="drpBig_relating_type" Onchange="javascript:linkage(this.id,'drpSmall_relating_type','',arrSubRelatingType);">
<option value="">-请选择-</option>
<exp:options name="drpBig_relating_type" list="groupnameListrelating" idfield="group_id" namefield="group_name" default="<%=this.value("val_big_relating","")%>" />
</select>
</td>
<td height="35" align="right">关联交易子类别:</td>
<td height="35">
<select id="drpSmall_relating_type" name="drpSmall_relating_type">
<option value="">-请选择-</option>
<exp:options name="drpSmall_relating_type" list="typenameListrelatingSub" idfield="type_id" namefield="type_name" default="<%=this.value("val_small_relating","")%>"/>
</select>
</td>