Posted in Javascript onAugust 30, 2011
演示地址: http://demo.3water.com/js/2011/js_select/index.htm
数据
var data=[ {id:1,name:"前端开发",pid:0}, {id:2,name:"CSS",pid:1}, {id:3,name:"JS",pid:1}, {id:4,name:"HTML",pid:1}, {id:5,name:"数据库",pid:0}, {id:6,name:"SQLServer",pid:5}, {id:7,name:"MYSql",pid:5}, {id:8,name:"Oracle",pid:5}, {id:9,name:"PLSQL",pid:8} ];
无限级 select demo1
var demo1=Doc.Get("demo1"); var chg=function(obj){ if(obj.options.length>1){ obj.selectedIndex=0; demo1.appendChild(obj); } } var sel1=new Select(data,chg); var _arr=sel1.getDom(); for(var i=0;i<_arr.length;i++){ demo1.appendChild(_arr[i]); }
无限级 select demo2
var demo2=Doc.Get("demo2"); var chg=function(obj){ if(obj.options.length>1){ obj.selectedIndex=0; demo2.appendChild(obj); } } var sel=new Select(data,chg); var _arr=sel.getDom(9); for(var i=0;i<_arr.length;i++){ demo2.appendChild(_arr[i]); }
JS 无限级 Select效果实现代码(json格式)
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@