css中style和class的载入次序示例详细介绍

2021-01-20 10:42 jianzhan

拷贝编码
编码以下:

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf⑻" />
<title>test</title>
<meta name="author" content="Administrator" />
<!-- Date: 2013⑴0-09 -->
<style type="text/css" media="screen">
.aa{
cursor: wait;
color: #f00;
}
</style>
<script type="text/javascript">
function clickD(obj){
//obj.style.color = "#f00";
//obj.style.cursor = "wait";
obj.className = "aa";
}
</script>
</head>
<body>
<div onclick="clickD(this)" style="cursor: pointer">点一下了试1下</div>
</body>
</html>

这样的写法,不容易遮盖style的cursor特性,以style中的特性为最终結果!

用注解中的写法,会遮盖掉style的特性!