<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<a href="#">重要</a>
<a href="#">重要</a>
<a href="#">重要</a>
<a href="#">重要</a>
<a href="#">dcgdf</a>
<a href="#">重dg要</a>
<a href="#">哈哈哈</a>
<a href="#">天空</a>
<script>
var a_array = document.getElementsByTagName('a');
for(var key in a_array) {
if(a_array[key].innerHTML == '重要') {
a_array[key].style.color = 'red';
} else {
a_array[key].style.color = 'green';
}
}
</script>
</body>
</html>