I have the following code:
Javascript Test
<script>
function mudaLampada(tipo){
if(tipo == 1){
arquivo = "_imagens/lampada-acesa.jpg";
}
if(tipo==2){
arquivo= "_imagens/lampada-apagada.jpg";
}
if(tipo == 3){
arquivo= "_imagens/lampada-quebrada.jpg";
}
document.getElementById("luz").src= arquivo;
}
</script>
<body>
<h1>Acenda Lampada</h1>
<img src="_imagens/lampada-apagada.jpg" id="luz" onmouseover="mudaLampada(1)" onmouseout="mudaLampada(2)" onmouseclick="mudaLampada(3)">
</body>
The function works for types 1 and 2, but for type 3 nothing happens; Can someone find the error? Thank you.