-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexe006.html
43 lines (38 loc) · 1.29 KB
/
exe006.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
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DETRAN</title>
<style>
body {
background-color: black;
color:white;
font: normal 16pt Arial;
}
input {
font: normal 15pt Arial;
width: 100px;
}
</style>
</head>
<body>
<h1>Sistema de Multas</h1>
Velocidade do Carro: <input type="number" name="txtvel" id="txtvel"> Km/h
<input type="button" value="Verificar" onclick="calcular()">
<div id="resposta">
</div>
<script>
function calcular() {
let txtv = window.document.getElementById('txtvel'); // Recebe o input.
let resposta = window.document.querySelector('div#resposta'); // Recebe a div.
let vel = Number(txtv.value); // Recebe o valor do input.
resposta.innerHTML = `<p>Sua velocidade atual é de <strong>${vel}Km/h</strong>.</p>`;
if (vel > 60) {
resposta.innerHTML+= `<p>Você está <strong>MULTADO</strong> por excesso de velocidade!</p> `
}
resposta.innerHTML += `<p>Dirija sempre com cinto de segurança!</p> `
}
</script>
</body>
</html>