Home > Web Front-end > JS Tutorial > JS infinite level Select effect implementation code (json format)_form special effects

JS infinite level Select effect implementation code (json format)_form special effects

WBOY
Release: 2016-05-16 18:02:49
Original
899 people have browsed it

Demo address: http://demo.jb51.net/js/2011/js_select/index.htm
Data

Copy code The code is as follows:

var data=[
{id:1,name:"Front-end Development",pid:0},
{id: 2,name:"CSS",pid:1},
{id:3,name:"JS",pid:1},
{id:4,name:"HTML",pid:1} ,
{id:5,name:"database",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}
];

Infinite level select demo1
Copy code The code is as follows:

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]);
}

Infinite level select demo2
Copy code The code is as follows:

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]) ;
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template