<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>$永远的24k纯帅$</title>
<style>
div{
width: 200px;
height: 100px;
background-color: yellow;
}
.cls{
background-color: green;
}
</style>
</head>
<body>
<input type="button" value="移除自定义属性" id="btn"/>
<div id="dv" score="10" class="cls"></div>
<script src="common.js"></script>
<script>
//移除自定义属性:removeAttribute("属性的名字")
//点击按钮移除元素的自定义属性
my$("btn").onclick=function () {
//my$("dv").removeAttribute("score");
//移除元素的类样式
//值没有了,但是属性还是有的
//my$("dv").className="";
//也可以移除元素的自带的属性
my$("dv").removeAttribute("class");
};
</script>
</body>
</html>