我试图制作一个通用脚本来更改鼠标悬停和鼠标悬停时的图像。
这是我正在尝试的,但它不起作用。
<script language="javascript" type="text/javascript">
function mouseOverImage()
{
document.getElementById(this.id).src = "/templates/articulistas/images/" + this.id + ".gif";
}
function mouseOutImage()
{
document.getElementById(this.id).src = "/templates/articulistas/images/" + this.id + "-off.gif";
}
</script>
的HTML:
<a href="" title="Aumentar o Tamanho da Letra" class="increaseFont">
<img id="aumentar-letra" src="/templates/articulistas/images/aumentar-letra-off.gif" onmouseover="mouseOverImage(this)" onmouseout="mouseOutImage(this)" /></a>
<a href="" title="Diminuir o Tamanho da Letra" class="decreaseFont">
<img id="diminuir-letra" src="/templates/articulistas/images/diminuir-letra-off.gif" onmouseover="mouseOverImage(this)" onmouseout="mouseOutImage(this)" /></a>