这是HTML页面。当鼠标移到或移出时,文本中的颜色应该改变。
<html>
<head>
<title>Untitled</title>
<script type="text/javascript" src="prjs10_2.js"></script>
</head>
<body>
<p> This is very <span id="int">interesting</span>!</p>
</body>
</html>
这是 JavaScript 文件。你能修复 addEventListener 方法必须执行吗?
var int = document.getElementById('int');
int.document.addEventListener("mouseover", function() {
int.style.color = "#FF0000";}, false);
int.document.addEventListener("mouseout", function() {
int.style.color = "#000000"}, false);