1
I am developing a code for user interaction, in which it should light a lamp when passing the mouse over, and break it case click about her.
The iteration of hover is occurring normally, but click does not work in the IE, Chrome.
Anyone can help?
function MudaLampada(tipo) {
if (tipo == 1) {
arquivo = "http://i.stack.imgur.com/ybxlO.jpg";
}
if (tipo == 2) {
arquivo = "http://i.stack.imgur.com/ybxlO.jpg";
}
if (tipo == 3) {
arquivo = "http://i.stack.imgur.com/MRjsF.jpg";
}
document.getElementById("luz").src = arquivo;
}
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Teste Javascript</title>
<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>
</head>
<body>
<h1>Acenda a Lampada</h1>
<img src="_imagens/lampada-apagada.jpg" id="luz" onmousemove="MudaLampada(1)" onmouseout="MudaLampada(2)" onclick="MudaLampada(3)" />
</body>
</html>



Which version of IE does not work?
– Sergio
In IE it is working just not in others but it gives a certain bug in IE tbm
– Felipe Paulo Braz Souza