当前位置: 代码迷 >> JavaScript >> js 删除某个元素上的ul标记
  详细解决方案

js 删除某个元素上的ul标记

热度:377   发布时间:2012-08-13 13:21:53.0
js 删除某个元素下的ul标记

现在做一个ajax动态树形目录,当点击一本书的时候发送ajax请求,从服务器返回图书的一级目录,将放回的数据绑定到本书的<li>标记下边。
现在有个问题,当一本书点击多次时该书的目录则会被绑定多次,现在想将li ID为200804010001 下的<ul>标记中的内容删除掉,也包括<ul>标记。
请问哪位高手能指点一二。

代码如下
HTML code


<li id="200804010001" class="Opened"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001');" src="css/s.gif"><a id="link_200804010001" onclick="ExCls(this,'Opened','Closed',1,'200804010001');" style="cursor:pointer;">山东年鉴1987</a>
<ul><li id="200804010001_126779" class="Child"><img class="s" src="css/s.gif"><a id="link_200804010001_126779" style="cursor:pointer;" onclick="document.getElementById('content_iframe').src='content_iframe.aspx?bookid=200804010001&amp;contentid=126779&amp;type=d&amp;show=content' ">编纂委员</a></li>
<li id="200804010001_126780" class="Child"><img class="s" src="css/s.gif"><a id="link_200804010001_126780" style="cursor:pointer;" onclick="document.getElementById('content_iframe').src='content_iframe.aspx?bookid=200804010001&amp;contentid=126780&amp;type=d&amp;show=content' ">编辑说明</a></li>
<li id="200804010001_126781" class="Child"><img class="s" src="css/s.gif"><a id="link_200804010001_126781" style="cursor:pointer;" onclick="document.getElementById('content_iframe').src='content_iframe.aspx?bookid=200804010001&amp;contentid=126781&amp;type=d&amp;show=content' ">序</a></li>
<li id="200804010001_126782" class="Child"><img class="s" src="css/s.gif"><a id="link_200804010001_126782" style="cursor:pointer;" onclick="document.getElementById('content_iframe').src='content_iframe.aspx?bookid=200804010001&amp;contentid=126782&amp;type=d&amp;show=content' ">转发省地方史志编纂委员会《关于编辑出版〈山东年鉴〉报告》的通知</a></li>
<li id="200804010001_126783" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126783');" src="css/s.gif"><a id="link_200804010001_126783" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126783');" style="cursor:pointer;">大事记</a>
</li><li id="200804010001_126784" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126784');" src="css/s.gif"><a id="link_200804010001_126784" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126784');" style="cursor:pointer;">概况</a>
</li><li id="200804010001_126789" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126789');" src="css/s.gif"><a id="link_200804010001_126789" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126789');" style="cursor:pointer;">政治</a>
</li><li id="200804010001_126810" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126810');" src="css/s.gif"><a id="link_200804010001_126810" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126810');" style="cursor:pointer;">军事</a>
</li><li id="200804010001_126815" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126815');" src="css/s.gif"><a id="link_200804010001_126815" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126815');" style="cursor:pointer;">法制</a>
</li><li id="200804010001_126821" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126821');" src="css/s.gif"><a id="link_200804010001_126821" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126821');" style="cursor:pointer;">经济</a>
</li><li id="200804010001_126835" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126835');" src="css/s.gif"><a id="link_200804010001_126835" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126835');" style="cursor:pointer;">工业</a>
</li><li id="200804010001_126851" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126851');" src="css/s.gif"><a id="link_200804010001_126851" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126851');" style="cursor:pointer;">农业</a>
</li><li id="200804010001_126861" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126861');" src="css/s.gif"><a id="link_200804010001_126861" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126861');" style="cursor:pointer;">交通·邮电</a>
</li><li id="200804010001_126868" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126868');" src="css/s.gif"><a id="link_200804010001_126868" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126868');" style="cursor:pointer;">建设·环保</a>
</li><li id="200804010001_126878" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126878');" src="css/s.gif"><a id="link_200804010001_126878" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126878');" style="cursor:pointer;">财政·金融</a>
</li><li id="200804010001_126886" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126886');" src="css/s.gif"><a id="link_200804010001_126886" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126886');" style="cursor:pointer;">商业</a>
</li><li id="200804010001_126895" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126895');" src="css/s.gif"><a id="link_200804010001_126895" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126895');" style="cursor:pointer;">科学技术</a>
</li><li id="200804010001_126908" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126908');" src="css/s.gif"><a id="link_200804010001_126908" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126908');" style="cursor:pointer;">教育</a>
</li><li id="200804010001_126916" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126916');" src="css/s.gif"><a id="link_200804010001_126916" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126916');" style="cursor:pointer;">文学艺术</a>
</li><li id="200804010001_126933" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126933');" src="css/s.gif"><a id="link_200804010001_126933" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126933');" style="cursor:pointer;">卫生·体育</a>
</li><li id="200804010001_126942" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126942');" src="css/s.gif"><a id="link_200804010001_126942" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126942');" style="cursor:pointer;">社会生活</a>
</li><li id="200804010001_126951" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126951');" src="css/s.gif"><a id="link_200804010001_126951" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126951');" style="cursor:pointer;">人物</a>
</li><li id="200804010001_126955" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126955');" src="css/s.gif"><a id="link_200804010001_126955" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126955');" style="cursor:pointer;">市、地、县概况</a>
</li><li id="200804010001_126970" class="Closed"><img class="s" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126970');" src="css/s.gif"><a id="link_200804010001_126970" onclick="ExCls(this,'Opened','Closed',1,'200804010001_126970');" style="cursor:pointer;">文献</a>
</li><li id="200804010001_126971" class="Child"><img class="s" src="css/s.gif"><a id="link_200804010001_126971" style="cursor:pointer;" onclick="document.getElementById('content_iframe').src='content_iframe.aspx?bookid=200804010001&amp;contentid=126971&amp;type=d&amp;show=content' ">附录</a></li>
</ul>
<li>

 
  相关解决方案