-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
132 lines (112 loc) · 4.52 KB
/
index.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ex04</title>
<style>
input[type=text], input[type=number]{
border-radius:4px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
box-shadow: 1px 1px 2px #333333;
-moz-box-shadow: 1px 1px 2px #333333;
-webkit-box-shadow: 1px 1px 2px #333333;
border:1px solid #000000;
}
textarea{
border: 1px solid #000000;
background:#cccccc;
width:150px;
height:100px;
border-radius:4px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
}
fieldset{
width:600px;
height:80px;
border-color: red;
}
legend
{
font-style:bold;
font-family: "Segoe UI";
}
</style>
</head>
<body>
<h2>Pesquisa de quais destas pizzas você mais gosta?</h2>
<p>
<label for="nome">Nome:</label>
<input type="text" placeholder="Infome nome completo" id="nome" name="nome" size="50"><br><br>
<label >Sexo:</label>
<input type="radio" name="genero" id="masc" value="Masculino">
<label for="masc">Masculino</label>
<input type="radio" name="genero" id="femi" value="Feminino">
<label for="femi">Feminino</label><br><br>
<label for="idade">Sua idade:</label>
<input type="number" id="idade" size="5"><br><br>
<label for="fone">Telefone:</label>
<input type="text" id="fone" size="10"><br><br>
<label for="end">Endereço:</label>
<input type="text" id="end" size="50">
<label for="num">Nº</label>
<input type="text" id="num" size="5" ><br><br>
<label for="cidade">Cidade</label>
<input type="text" id="cidade" size="25"><br><br>
<label for="estados">Estados</label>
<select id="estados">
<option value=""></option>
<option value="PR">Paraná - PR</option>
<option value="SC">Santa Catarina - SC</option>
<option value="RS">Rio Grande do Sul - RS</option>
</select>
</p>
<form action="#" method="post" class="demoForm" id="pizzaForm" ></form>
<fieldset class="nd">
<legend>Selecione uma Pizza</legend>
<p id="pizza">
<input type="checkbox" id="1" value="3 Queijos" /> 3 Queijos
<input type="checkbox" id="2" value="Frango com requeijão" /> Frango com requeijão
<input type="checkbox" id="3" value="Margherita" /> Margherita
<input type="checkbox" id="4" value="Mussarela" /> Mussarela
<input type="checkbox" id="5" value="Pepperoni" /> Pepperoni
</p>
</fieldset>
</form><br>
<button id="btn">Responder pesquisa</button>
<div id="resultado"></div>
<script>
var botao = document.getElementById("btn");
botao.addEventListener("click", function() {
var nome = document.getElementById("nome").value.toUpperCase();
var idade = document.getElementById("idade").value;
var fone = document.getElementById("fone").value;
var end = document.getElementById("end").value.toUpperCase();
var numero = document.getElementById("num").value;
var cidade = document.getElementById("cidade").value.toUpperCase();
var estado = document.getElementById("estados");
var sexo = document.getElementsByName("genero");
for (var x = 0; x < sexo.length; x++){
if(sexo[x].checked){
var result = sexo[x].value ;
}
}
var sabores = '';
for( var x =1; x <= 5; x++){
var checkbox = document.getElementById(x);
if(checkbox.checked){
sabores += checkbox.value + "<br>"
}
}
document.getElementById("resultado").innerHTML =
`${nome} <br> ${result.toUpperCase()} <br> ${idade} <br>
${fone} <br> ${end} Nº ${numero} <br> ${cidade} <br>
${estado[estado.selectedIndex].text.toUpperCase()} <br> Sabores preferidos: <br> ${sabores}`;
});
</script>
</body>
</html>
</body>
</html>