英文菜单折叠

& ltstyle & gt

/*自己编风格*/

。父母?。子{显示:?无;}

& lt/style & gt;

& ltul?class="parent " >

& lt李?class="pli " >

& ltspan & gtphp & lt/span>。

& ltul?class="son " >

& lt李& gtPHP 1 & lt;/李& gt

& lt李& gtPHP 1 & lt;/李& gt

& lt/ul & gt;

& lt/李& gt

& lt李?class="pli " >

& ltspan & gtphp & lt/span>。

& ltul?class="son " >

& lt李& gtPHP 1 & lt;/李& gt

& lt李& gtPHP 1 & lt;/李& gt

& lt/ul & gt;

& lt/李& gt

& lt李?class="pli " >

& ltspan & gtphp & lt/span>。

& ltul?class="son " >

& lt李& gtPHP 1 & lt;/李& gt

& lt李& gtPHP 1 & lt;/李& gt

& lt/ul & gt;

& lt/李& gt

& lt李?class="pli " >

& ltspan & gtphp & lt/span>。

& ltul?class="son " >

& lt李& gtPHP 1 & lt;/李& gt

& lt李& gtPHP 1 & lt;/李& gt

& lt/ul & gt;

& lt/李& gt

& lt李?class="pli " >

& ltspan & gtphp & lt/span>。

& ltul?class="son " >

& lt李& gtPHP 1 & lt;/李& gt

& lt李& gtPHP 1 & lt;/李& gt

& lt/ul & gt;

& lt/李& gt

& lt/ul & gt;var?pli?=?document.querySelectorAll("。父母?。pli?span”);

for(var?我?=?0;我& ltpli .长度;i++){

pli[i]。指数?=?我;

pli[i]。onclick?=?函数(){

for(var?j?=?0;j & ltpli .长度;j++){

document.querySelectorAll("。父母?。pli?。son ")[j]. style . display = " none ";

}

this.parentNode.querySelector("。son "). style . display = " block ";

}

}