我刚刚完成了我的代码,但没有显示tick.gif,而是显示了单词“tick”,上面有一个框。此外,onmouseover 功能也不起作用。
<!DOCTYPE html>
<html>
<head>
<title>Changeup test</title>
</head>
<body>
<img scr="tick.gif" alt="tick" onmouseover="this.scr='tick2.gif';
"onmouseout="this.gif='tick.gif';" />
</body>
</html>
最佳答案
您上面粘贴的代码中标记的源属性拼写错误。它需要是 src。
<!DOCTYPE html>
<html>
<head>
<title>Changeup test</title>
</head>
<body>
<img src="tick.gif" alt="tick" onmouseover="this.src='tick2.gif'; "onmouseout="this.src='tick.gif';" />
</body>
</html>
关于JavaScript 代码无法正常运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19625708/