-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finalizando o conteúdo sobre formulários
- Loading branch information
Showing
6 changed files
with
165 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Formulários</title> | ||
|
||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
|
||
<body> | ||
<h1>Formulários - campo de <em>output</em> (I)</h1> | ||
<hr> | ||
|
||
<!-- O campo output não será enviado para a página de destino --> | ||
<!-- Usando o 'onkeydown' podemos fazer o campo sensivel apenas para as setas --> | ||
<form action="./cadastro.php" method="get" autocomplete="on"> | ||
<p> | ||
<label for="in1">Número 1:</label> | ||
<input type="number" name="n1" id="in1" min="0" max="50" required oninput="isoma.innerHTML = Number(in1.value) + Number(in2.value)" onkeydown="return false"> | ||
</p> | ||
|
||
<p> | ||
<label for="in2">Número 2:</label> | ||
<input type="number" name="n2" id="in2" min="0" max="50" required oninput="isoma.innerHTML = Number(in1.value) + Number(in2.value)"> | ||
</p> | ||
|
||
<p> | ||
<label for="isoma">Soma:</label> | ||
<output name="soma" id="isoma">0</output> | ||
</p> | ||
|
||
<p><input type="submit" value="Enviar"> | ||
<input type="reset" value="Limpar"></p> | ||
</form> | ||
|
||
<script> | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Formulários</title> | ||
|
||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
|
||
<body> | ||
<h1>Formulários - campo de <em>output</em> (II)</h1> | ||
<hr> | ||
|
||
<form action="./cadastro.php" method="get" autocomplete="on"> | ||
<p> | ||
<label for="inum">Número:</label> | ||
<input type="range" name="num" id="inum" min="0" max="100" value="50" oninput="ival.innerHTML = Number(inum.value)"> | ||
<output id="ival">50</output> | ||
</p> | ||
|
||
<p><input type="submit" value="Enviar"> | ||
<input type="reset" value="Limpar" onclick="ival.innerHTML = 50"></p> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Formulários</title> | ||
|
||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
|
||
<body> | ||
<h1>Formulários - campo de <em>output</em> (III)</h1> | ||
<hr> | ||
|
||
<form action="./cadastro.php" method="get" autocomplete="on"> | ||
<p> | ||
<label for="iano">Em que ano você nasceu?:</label> | ||
<input type="number" name="ano" id="iano" min="1900" max="2020" value="1990" oninput="calcIdade()" onkeydown="return false"> | ||
</p> | ||
|
||
<p> | ||
<label for="iidade">Sua idade é: </label> | ||
<output id="iidade">34</output> | ||
</p> | ||
|
||
<!-- O reset não corrige o valor do output --> | ||
<p><input type="submit" value="Enviar"> | ||
<input type="reset" value="Limpar" onclick="calcIdade(true)"></p> | ||
</form> | ||
|
||
<script> | ||
function calcIdade( clear = false ){ | ||
let atual = new Date().getFullYear() | ||
|
||
if( !clear ) | ||
{ | ||
iidade.innerHTML = Number(atual) - Number(iano.value) | ||
} | ||
else{ | ||
iidade.innerHTML = iidade.innerHTML = Number(atual) - 1990 | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters