私は現在、ある種の小さなhtmlゲームで作業しています。mouseOver()と複数の要素で何か問題があります
<div id="BS">
<img style="position:absolute; top:375px; left:500px; width:176px; height:286px;" onmouseover="mouseOver()" src="Pictures/BS1.png"/>
</div>
<script type="text/javascript">
function mouseOver() {
document.getElementById("BS").innerHTML = '<img style="position:absolute; top:375px; left:500px; width:176px; height:286px;" src="Pictures/BS2.png" onmouseout="mouseOut()"/>';
}
function mouseOut() {
document.getElementById("BS").innerHTML = '<img style="position:absolute; top:375px; left:500px; width:176px; height:286px;" src="Pictures/BS1.png" onmouseover="mouseOver()"/>';
}
</script>
<div id="Radio">
<img style="position:absolute; top:478px; left:768px; width:101px; height:71px;" onmouseover="mouseOver()" src="Pictures/radio1.png"/>
</div>
<script type="text/javascript">
function mouseOver() {
document.getElementById("Radio").innerHTML = '<img style="position:absolute; top:478px; left:768px; width:101px; height:71px;" src="Pictures/radio2.png" onmouseout="mouseOut()"/>';
}
function mouseOut() {
document.getElementById("Radio").innerHTML = '<img style="position:absolute; top:478px; left:768px; width:101px; height:71px;" src="Pictures/radio1.png" onmouseover="mouseOver()"/>';
}
</script>
問題は、唯一の最後の項目がコード化された(ここでは、Radio
)私はそれに私のカーソルを置いていたときに取り組んでいる: 以下は私のコードです。だから私は不思議だった、これを修正する方法はありますか?私は... 感謝を少なくとも2つの以上の要素を配置する計画をした原因、 ポール
これらの関数を宣言するたびに、以前のインスタンス – charlietfl