开发者

JavaScript can control elements in a panel?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜