下拉框动态连动javascript 代码

< scriptlanguage = " javascript " >
// varcarr=newArray(<%=cdt.Rows.Count%>);
var carr = new Array();
<%
for ( int i = 0 ;i < cdt.Rows.Count;i ++ )
{
%>
carr[
<%= i %> ] = new Array( " <%=cdt.Rows[i][ " sid " ]%> " , " <%=cdt.Rows[i][ " cname " ]%> " , " <%=cdt.Rows[i][ " cid " ]%> " );
<%
}
%>
function scity(val)
{
// alert(val);
document.getElementById( " sel " ).length = 0 ;
for ( var i = 0 ;i < carr.length;i ++ )
{
if (carr[i][ 0 ] == val)
{
document.getElementById(
" sel " ).options.add( new Option(carr[i][ 1 ],carr[i][ 2 ]));
}
}
}
</ script >
< scriptlanguage = " javascript " >
// varcarr=newArray(<%=cdt.Rows.Count%>);
var carr = new Array();
<%
for ( int i = 0 ;i < cdt.Rows.Count;i ++ )
{
%>
carr[
<%= i %> ] = new Array( " <%=cdt.Rows[i][ " sid " ]%> " , " <%=cdt.Rows[i][ " cname " ]%>#<%=cdt.Rows[i][ " cid " ]%> " );
<%
}
%>
function scity(val)
{
// alert(val);
document.getElementById( " sel " ).length = 0 ;
for ( var i = 0 ;i < carr.length;i ++ )
{
if (carr[i][ 0 ] == val)
{
document.getElementById(
" sel " ).options.add( new Option(carr[i][ 1 ].split( " # " )[ 0 ],carr[i][ 1 ].split( " # " )[ 1 ]));
}
}
}
</ script >

你可能感兴趣的:(JavaScript)