-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestejs03.html
35 lines (31 loc) · 1.09 KB
/
testejs03.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head>
<title>Teste JavaScript</title>
<meta charset="UTF-8">
<script>
var quebrada =false;
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"
// }
if(!quebrada){
document.getElementById("luz").src ="_imagens/"+ tipo +".jpg";
if(tipo=='lampada-quebrada'){
quebrada = true;
}
}
};
</script>
</head>
<body>
<h1>Acenda a Lamapda</h1>
<img src="_imagens/lampada-apagada.jpg" id="luz" onmousemove="mudaLampada('lampada-acesa')" onmouseout="mudaLampada('lampada-apagada')" onclick="mudaLampada('lampada-quebrada')"/>
</body>
</html>