删除属性,只保留<li>????

解决方案 »

  1.   


    <li style="width:200px;height:100px;border:red solid 1px"><img id="aa" src="http://www.baidu.com/img/logo-yy.gif"></li>
    <SCRIPT LANGUAGE="JavaScript">
    document.getElementById("aa").parentNode.style.removeAttribute("width");
    alert(document.getElementById("aa").parentNode.style.width);
    </SCRIPT>
      

  2.   

    <li style="width:200px;height:100px;border:red solid 1px" id="testLi"></li>
      document.getElementById('testLi').style ='';直接设为空不可以吗
      

  3.   

    难道lz想获取li里面的内容???  不清楚
      

  4.   


    <li style="width:200px;height:100px;border:red solid 1px"><img id="aa" src="http://www.baidu.com/img/logo-yy.gif"></li>
    <SCRIPT LANGUAGE="JavaScript">
    document.getElementById("aa").parentNode.style.cssText="";//这样是把style属性全部删除,1楼的是单独删 看你需求
    alert(document.getElementById("aa").parentNode.style.width);
    alert(document.getElementById("aa").parentNode.style.height);
    </SCRIPT>