Skip to content

Commit 3a0d665

Browse files
Add files 2
1 parent 8822dd9 commit 3a0d665

24 files changed

+1521
-0
lines changed

AnalizandoNumeros/test-numero.css

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
@charset "UTF-8";
2+
/* geral */
3+
* {
4+
padding: 0;
5+
margin: 0;
6+
}
7+
body {
8+
background-color: rgb(0, 165, 124);
9+
}
10+
11+
/* seção */
12+
section{
13+
14+
background-color: aliceblue;
15+
width: 50%;
16+
height: 10%;
17+
margin-left: auto;
18+
margin-right: auto;
19+
margin-top: 3%;
20+
border-radius: 15px;
21+
padding: 0% 0% 5% 0%;
22+
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.5);
23+
24+
}
25+
h1 {
26+
font-family: sans-serif;
27+
font-size: xx-large;
28+
text-align: center;
29+
margin-top: 3%;
30+
color: whitesmoke;
31+
}
32+
33+
h2 {
34+
font-family: sans-serif;
35+
font-size: x-large;
36+
text-align: center;
37+
margin: 2%;
38+
color: whitesmoke;
39+
}
40+
41+
p{
42+
font-family: sans-serif;
43+
font-size: large;
44+
}
45+
/*#idSelect{margin: 0% 0% 0% 5%;width: max-content ;padding: 1%;}
46+
47+
/* label */
48+
label{
49+
font-family: sans-serif;
50+
font-size: large;
51+
padding: 0% 0% 0% 0%;
52+
53+
}
54+
55+
/* input */
56+
input{width: 15%;margin-bottom: 1%;}
57+
58+
/* botao*/
59+
input#idBotao{
60+
padding: 1%;
61+
width:fit-content;
62+
margin-left: 0%;
63+
margin-right: 4%;
64+
}
65+
input#idBotao2{
66+
padding: 1%;
67+
width:fit-content;
68+
margin-top: 1%;
69+
margin-left: 0%;
70+
margin-right: 4%;
71+
}
72+
73+
div{padding: 2% 2% 0% 3%;}
74+
75+
p#idTxtResp{margin-left: 5%;margin-right: 10%;}
76+
77+
/* rodape */
78+
footer{
79+
text-align: center;
80+
padding: 1%;
81+
color: whitesmoke;
82+
83+
width: 25%;
84+
margin-left: auto;
85+
margin-right:auto ;
86+
margin-top: 1%;
87+
border-radius: 15px;
88+
}

AnalizandoNumeros/test-numero.html

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!DOCTYPE html>
2+
<html lang="pt-BR">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title> Analizador de Numeros </title>
8+
9+
<link rel="stylesheet" href="test-numero.css">
10+
11+
12+
13+
</head>
14+
15+
<body>
16+
<h1> Pagina em JavaScript !</h1>
17+
<h2> Analizador de Numeros </h2>
18+
19+
<section> <!-- aqui comeca a section -->
20+
<div>
21+
22+
23+
24+
<label> Numero (1 ate 100): </label>
25+
<input type="number" id="idNum">
26+
27+
<input type="button" value="Adicionar" onclick="adicionar()">
28+
29+
<br>
30+
<select name="" id="idSel" size="6">
31+
<option value=""> Valores</option>
32+
</select>
33+
34+
<br>
35+
<input type="button" value="Finalizar" onclick="finalizar()">
36+
37+
<p id="imprimir"> Resultado </p>
38+
39+
<script src="test-numero.js"></script>
40+
</div>
41+
42+
</section><!-- aqui termina o section -->
43+
44+
<footer>
45+
<p> &copy; create by alessandro </p>
46+
</footer>
47+
</body>
48+
49+
</html>

AnalizandoNumeros/test-numero.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
var numero = document.querySelector('input#idNum')
3+
var select = document.querySelector('select#idSel')
4+
var valores = []
5+
6+
var imprimir = document.querySelector('p#imprimir')
7+
8+
9+
function isNumero(){
10+
11+
if(Number(numero.value) >=1 && Number(numero.value) <=100 ){
12+
return true
13+
}else{
14+
return false
15+
}
16+
17+
}
18+
19+
20+
function isLista(n,valores){
21+
22+
if( valores.indexOf(n) != -1){
23+
return true
24+
}else{
25+
return false
26+
}
27+
28+
}
29+
30+
function adicionar(){
31+
n = Number(numero.value)
32+
33+
if(isNumero(n) && !isLista(n,valores)){
34+
valores.push(n)
35+
var option = document.createElement('option')
36+
option.innerHTML = ` valor ${n} adicionado`
37+
select.appendChild(option)
38+
39+
40+
}else{
41+
window.alert(' valor invalido ou ja digitado')
42+
}
43+
imprimir.innerHTML = ``
44+
numero.value = ''
45+
numero.focus()
46+
47+
}
48+
49+
function finalizar(){
50+
51+
if(valores.length == 0){
52+
window.alert('Adicione algum numero para finalizar ')
53+
}else{
54+
55+
imprimir.innerHTML += ` <p> Foram adicionados ${valores.length} valores </p>`
56+
57+
58+
}
59+
}

0 commit comments

Comments
 (0)