怎么用js把网页里多余的<UL></UL>代码去掉!
这样好像不行,<scripttype="text/javascript">if(abc123.innerHTML=='<UL></UL>')abc123.innerHTM...
这样好像不行,
<script type="text/javascript">
if (abc123.innerHTML == '<UL></UL>')
abc123.innerHTML = '';
</script>
<div id=abc123>
<LI><A href="product/?type=list&classid=6" target=_self>LED 柔性灯条</A>
<UL></UL>
<LI><A href="product/?type=list&classid=7" target=_self>LED 硬灯条(铝槽)</A>
<UL></UL>
<LI><A href="product/?type=list&classid=8" target=_self>LED 天花灯</A>
<UL></UL>
<LI><A href="product/?type=list&classid=9" target=_self>LED 射灯</A>
<UL></UL>
</div> 展开
<script type="text/javascript">
if (abc123.innerHTML == '<UL></UL>')
abc123.innerHTML = '';
</script>
<div id=abc123>
<LI><A href="product/?type=list&classid=6" target=_self>LED 柔性灯条</A>
<UL></UL>
<LI><A href="product/?type=list&classid=7" target=_self>LED 硬灯条(铝槽)</A>
<UL></UL>
<LI><A href="product/?type=list&classid=8" target=_self>LED 天花灯</A>
<UL></UL>
<LI><A href="product/?type=list&classid=9" target=_self>LED 射灯</A>
<UL></UL>
</div> 展开
展开全部
<div id=abc123>
<LI><A href="product/?type=list&classid=6" target=_self>LED 柔性灯条</A>
<UL></UL>
<LI><A href="product/?type=list&classid=7" target=_self>LED 硬灯条(铝槽)</A>
<UL></UL>
<LI><A href="product/?type=list&classid=8" target=_self>LED 天花灯</A>
<UL></UL>
<LI><A href="product/?type=list&classid=9" target=_self>LED 射灯</A>
<UL></UL>
</div>
<script type="text/javascript">
//这段js要写在DIV的后面
document.getElementById('abc123').innerHTML=document.getElementById('abc123').innerHTML.replace(/\<\u\l\>\<\/\u\l\>/g,"");
</script>
<LI><A href="product/?type=list&classid=6" target=_self>LED 柔性灯条</A>
<UL></UL>
<LI><A href="product/?type=list&classid=7" target=_self>LED 硬灯条(铝槽)</A>
<UL></UL>
<LI><A href="product/?type=list&classid=8" target=_self>LED 天花灯</A>
<UL></UL>
<LI><A href="product/?type=list&classid=9" target=_self>LED 射灯</A>
<UL></UL>
</div>
<script type="text/javascript">
//这段js要写在DIV的后面
document.getElementById('abc123').innerHTML=document.getElementById('abc123').innerHTML.replace(/\<\u\l\>\<\/\u\l\>/g,"");
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询