开发者

JavaScript can control elements in a panel?

开发者 https://www.devze.com 2023-03-15 08:32 出处:网络
I am looking for some sample JavaScript code that will allow me to have a list of N items and to be able to toggle that list between a collapsed top item and an expan开发者_开发知识库ded list of all o

I am looking for some sample JavaScript code that will allow me to have a list of N items and to be able to toggle that list between a collapsed top item and an expan开发者_开发知识库ded list of all of the items.

Anyone have any ideas?


I think you're looking for something like Treeview


You probably want to use a a function like:

function toggle(itemsInList) {
    for (var i = 0; i < itemsInList.length; ++i) {
        itemsInList[i].style.display = (itemsInList[i].style.display == "block") ? "none" : "block";
    }

}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号