点击该号码后,应将班级和标题从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;}
答案 0 :(得分:1)
答案 1 :(得分:1)
从功能中删除< /script>
标记。