php 二级下拉菜单源码,二级联动菜单-PHP源码

《script》ec(2);《script》

二级联动下拉菜单 自家用的 js二级联动菜单 其实我觉得 asp二级联动菜单 与 php二级联动菜单 两个相同只是表示方式不一样.

《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》

原创文章:转载请注明www.111cn.net

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值