-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex10.html
More file actions
47 lines (41 loc) · 1.33 KB
/
ex10.html
File metadata and controls
47 lines (41 loc) · 1.33 KB
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
44
45
46
47
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DETRAN</title>
<style>
main{
text-align: center;
background-color: grey;
margin: auto;
width: 500px;
height: 500px;
}
h1{
margin-bottom: 30px;
}
</style>
</head>
<body>
<main>
<h1>Site de Multas</h1>
Velocidade do carro <input type="number" name="txtvel" id="txtvel">
<input type="button" value="Verificar" onclick="calcular()">
<div id="res"></div>
</main>
<script>
function calcular(){
var txtv = window.document.querySelector("input#txtvel")
var res = window.document.querySelector("div#res")
var vel = Number(txtv.value)
res.innerHTML = `<p>Sua velocidade atual é de <strong> ${vel}km/hr</strong></p>`
if (vel > 60){
res.innerHTML +=(`Sua velocidade é ${vel}km/hr, Você será <strong> MULTADO </strong> por excesso de velocidade!!`)
res.innerHTML += `<p> Dirija sempre com cinto de segunrança!!!</p>`//+= de concatenação, uma string
}
}
</script>
</body>
</html>