下拉菜单联动请参考:
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
</head>
<%
String TProduct_ID="10000000,10000001,10000002,10001000";
String TCategory_ID="1000,1001,1002,1000";
String[] ACategory_ID={"1000","1001","1002","1000"};
int Counter=3;
%>
<body bgcolor="#FFFFFF" text="#000000">
<table width="778" border="0" cellspacing="0" cellpadding="0" height="100">
<FORM action="/OrderOnnet/AddOrderForm2.jsp" method=POST id=FormAddTempInfo name=FormAddTempInfo LANGUAGE=javascript onsubmit="return FormAddTempInfo_onsubmit()">
<tr bgcolor="#FFFFFF">
<td><SELECT id=Category_ID name=Category_ID LANGUAGE=javascript onchange="return Category_ID_onchange()">
<OPTION value="0" selected>请选择产品分类</OPTION>
<%
for(int i=0;i<ACategory_ID.length;i++){
%>
<OPTION value="<%=ACategory_ID%>"><%=ACategory_ID%></OPTION>
<%
}
%>
</SELECT></td>
<td colspan=2><div id="Product_Display"><SELECT id=Product_ID name=Product_ID>
<OPTION value="0" selected>请选择详细产品</OPTION>
</SELECT></div></td>
<td align="center">
<input type="text" name="Order_Number" id="Order_Number" class="formcss" size="6" value="1">
</td>
<td align="center">
<input type="image" border="0" name="SubmitAddTempInfo" src="/OrderOnnet/images/Add.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
</tr>
<tr>
<td align="center">
<input type="text" name="Ary_Product_ID" id="Ary_Product_ID" value=<%=TProduct_ID%> size="30">
</td>
<td align="center">
<input type="text" name="Ary_Category_ID" id="Ary_Category_ID" value=<%=TCategory_ID%> size="30">
</td>
</tr>
</FORM>
</table>
<SCRIPT LANGUAGE=javascript>
<!--
var Ary_Product_ID=FormAddTempInfo.Ary_Product_ID.value.split(',');
var Ary_Category_ID=FormAddTempInfo.Ary_Category_ID.value.split(',');
var Counter;
Counter=<%=Counter%>;
function Category_ID_onchange()
{
var Category_ID;
Category_ID =do
cument.FormAddTempInfo.Category_ID.value;
var OutPutText;
OutPutText="";
if (Category_ID==0)
{
OutPutText = '<SELECT id=Product_ID name=Product_ID><OPTION value="0" selected>请选择详细产品</OPTION></SELECT>';
Product_Display.innerHTML = OutPutText;
}
else
{
OutPutText = '<SELECT id=Product_ID name=Product_ID><OPTION value="0" selected>请选择详细产品</OPTION>';
for (var Counter1=0;Counter1<=Counter;Counter1++)
{
if (Ary_Category_ID[Counter1]==Category_ID)
{
OutPutText = OutPutText + '<Option Value="' + Ary_Product_ID[Counter1] + '">' + Ary_Product_ID[Counter1] + '</Option>';
}
}
OutPutText = OutPutText + '</SELECT>';
Product_Display.innerHTML = OutPutText;
}
}
function FormAddTempInfo_onsubmit()
{
if (document.FormAddTempInfo.Category_ID.value==0)
{
alert("请选择有效的产品分类!");
return false;
}
else
if (document.FormAddTempInfo.Product_ID.value==0)
{
alert("请选择要订购的产品!");
return false;
}
else
return true;
}
//-->
</SCRIPT>
</body>
</html>