0
我需要将图像替换掉。我相信它应该使用innerHTML
。将鼠标悬停在带有innerHTML的图像上
<body>
<a href="#">anime</a>
<a href="#">ponies</a>
<h1 class="panel">What fandom is better?</h1>
<div class="anime"> <img src="img/anime.png"> </div>
<div class="pony"> <img src="img/pony.png"> </div>
<p id="answer">Choose One</p>
</body>
/**
This is for element changes upon mousesing over of the area
*/`
document.getElementsByClassName("anime")[0].onmouseover=
function(){
orangeBorder1();
mouseAnime();
}
document.getElementsByClassName("pony")[0].onmouseover=
function(){
orangeBorder();
mousePony();
}
function mousePony(){
document.getElementById("pony").src="pony1.png";
}
你没有任何与id“小马”,所以它不抓住任何东西。你应该将id“pony”添加到img标签中,并且它应该可以工作。 – 2015-02-12 00:18:34