<div id="tree2" class="tree tree-unselectable">
<div class="tree-folder" style="display:none;">
<div class="tree-folder-header">
<i class="icon-folder-close">
</i>
<div class="tree-folder-name">
</div>
</div>
<div class="tree-folder-content">
</div>
<div class="tree-loader" style="display: none;">
</div>
</div>
<div class="tree-item" style="display:none;">
<div class="tree-item-name">
</div>
</div>
<div class="tree-folder" style="display: block;">
<div class="tree-folder-header">
<i class="red icon-folder-open">
</i>
<div class="tree-folder-name">
Pictures
</div>
</div>
<div class="tree-folder-content">
<div class="tree-folder" style="display: block;">
<div class="tree-folder-header">
<i class="pink icon-folder-open">
</i>
<div class="tree-folder-name">
Wallpapers
</div>
</div>
<div class="tree-folder-content">
<div class="tree-item" style="display: block;">
<div class="tree-item-name">
<i class="icon-picture green">
</i>
wallpaper1.jpg
</div>
</div>
<div class="tree-item" style="display: block;">
<div class="tree-item-name">
<i class="icon-picture green">
</i>
wallpaper2.jpg
</div>
</div>
<div class="tree-item" style="display: block;">
<div class="tree-item-name">
<i class="icon-picture green">
</i>
wallpaper3.jpg
</div>
</div>
<div class="tree-item" style="display: block;">
<div class="tree-item-name">
<i class="icon-picture green">
</i>
wallpaper4.jpg
</div>
</div>
</div>
<div class="tree-loader" style="display: none;">
<div class="tree-loading">
<i class="icon-refresh icon-spin blue">
</i>
</div>
</div>
</div>
<div class="tree-folder" style="display: block;">
<div class="tree-folder-header">
<i class="pink icon-folder-open">
</i>
<div class="tree-folder-name">
Camera
</div>
</div>
<div class="tree-folder-content">
<div class="tree-item" style="display: block;">
<div class="tree-item-name">
<i class="icon-picture green">
</i>
photo1.jpg
</div>
</div>
<div class="tree-item" style="display: block;">
<div class="tree-item-name">
<i class="icon-picture green">
</i>
photo2.jpg
</div>
</div>
<div class="tree-item" style="display: block;">
<div class="tree-item-name">
<i class="icon-picture green">
</i>
photo3.jpg
</div>
</div>
<div class="tree-item" style="display: block;">
<div class="tree-item-name">
<i class="icon-picture green">
</i>
photo4.jpg
</div>
</div>
<div class="tree-item" style="display: block;">
<div class="tree-item-name">
<i class="icon-picture green">
</i>
photo5.jpg
</div>
</div>
<div class="tree-item" style="display: block;">
<div class="tree-item-name">
<i class="icon-picture green">
</i>
photo6.jpg
</div>
</div>
</div>
<div class="tree-loader" style="display: none;">
<div class="tree-loading">
<i class="icon-refresh icon-spin blue">
</i>
</div>
</div>
</div>
</div>
<div class="tree-loader" style="display: none;">
<div class="tree-loading">
<i class="icon-refresh icon-spin blue">
</i>
</div>
</div>
</div>
<div class="tree-item-name">
<i class="icon-book blue">
</i>
Manual.html
</div>
</div>
</div>
得到的效果
求大牛帮帮忙遍历下,递归实现
6 个解决方案
#1
顶顶顶顶顶顶顶顶
#3
我的问题是把list递归出来,但是html有个父div包含子div的问题,递归完老是少闭合的标签</div>
#4
导致样式乱七八糟的
#5
str +="<div>";
str+=递归方法;
str+="</div>";
这样写不可能缺少闭合标签吧
#6
最多在这个拼接之前判断下你的实体,如果有才执行这段,避免不必要的div
#1
顶顶顶顶顶顶顶顶
#2
http://bbs.csdn.net/topics/391015868
参考下这个递归写法呗
参考下这个递归写法呗
#3
我的问题是把list递归出来,但是html有个父div包含子div的问题,递归完老是少闭合的标签</div>
#4
导致样式乱七八糟的
#5
str +="<div>";
str+=递归方法;
str+="</div>";
这样写不可能缺少闭合标签吧
#6
最多在这个拼接之前判断下你的实体,如果有才执行这段,避免不必要的div