一、效果
代码
<style>div{width:100px;height: 100px;background-color: red;}.clsP{background-color: #00FF00;}</style><body><input type="button" value="移除属性" id="btn" /><div id="dv" score="10" class="cls"></div><script>function my(id){return document.getElementById(id);}my("btn").onclick=function(){//移除自定义属性//my("dv").removeAttribute("score")//使用className可以移除值但属性还有//my("dv").className="";my("dv").removeAttribute("cls")}</script></body>