Ec (2); & nbsp; Level-2 linkage drop-down menu & nbsp; self-built js level-2 linkage menu & nbsp; in fact, I think asp level-2 linkage menu & nbsp; similar to & nbsp; php level-2 linkage menu & nbsp; the two items are the same, but the representation method is different. & nbsp; & lt; script & gt; functionGetObjId (ObjName) {alert (document. all. tags (script ec (2); script
Secondary linkage drop-down menuIn fact, I think the two js level-2 linkage menus of asp level-2 linkage menus are the same as those of php level-2 linkage menus.
Script
Function GetObjId (ObjName)
{
// Alert (document. all. tags ('select') [I]. name );
For (I = 0; I <document. all. tags ('select'). length; I ++)
{
If (document. all. tags ('select') [I]. name = ObjName) {return (I); break ;}
}
Return (-1 );
}
Function Do_ToDo_Change (ObjName1, ObjName2, StatInt)
{
// Document. forms [0]. elements [0]. name
Var id1, id2, tempstr, tempint
Var my_array = new Array ();
$ List = '';
For ($ I = 1; $ I <= 11; $ I ++ ){
$ Osql = "Select * from tanbme where f_id = $ I ";
$ Resul = mysql_query ($ osql) or die (mysql_error ());
While ($ res = mysql_fetch_array ($ resul )){
$ List = $ list. $ res ['id']. '|'. $ res ['z _ name']. ',';
}
?>
My_array [ ] =' ';
$ List = '';
}
?>
Id1 = GetObjId (ObjName1 );
Id2 = GetObjId (ObjName2 );
Tempint = document. all. tags ('select') [id2]. length;
For (I = 1; I <tempint; I ++) {document. all. tags ('select') [id2]. options [1] = null}
If (document. all. tags ('select') [id1]. selectedIndex> StatInt-1)
{
Tempstr = my_array [document. all. tags ('select') [id1]. selectedIndex-1]. split (",");
For (I = 1; I <= tempstr. length; I ++) {document. all. tags ('select') [id2]. options [I] = new Option (tempstr [I-1]. substr (tempstr [I-1]. indexOf ("|") + 1), tempstr [I-1]. substr (0, tempstr [I-1]. indexOf ("| ")))}
}
}
Script
Original article: www.111cn.net