单击数字应将类和标题从 not_viewed 更改为查看,使颜色从红色变为绿色。但显然,它不起作用,因为没有发生颜色变化。
html
<span title="not_viewed" class="not_viewed" id="1" onclick="javascript:changeclass()">1</span>
Javascript
function changeclass() {var NAME = document.getElementById("1"); NAME.className = "viewed" NAME.title="viewed"
< /script>
}
css
span.viewed{color:green; }
span.not_viewed{color:red;}
span{cursor:pointer;}