Obrigado, Convidado!
Bem-vindo ao FMGARCIA - SAMP!
Tópicos mais visitados
Administradores
Top dos mais postadores
HuemersonFMG | ||||
CleidiSilva21 | ||||
barbfix | ||||
Tranks_NorT | ||||
RenatoFMG | ||||
William | ||||
Vinícius_ Kawasaki | ||||
scorpio | ||||
alfredw10 |
FMG - O MELHOR SERVIDOR RPG SAMP - RADIO ONLINE
Simples Calculadora em HTML - Visual Studio Code
Página 1 de 1
Simples Calculadora em HTML - Visual Studio Code
Simples Calculadora em HTML - Visual Studio Code
Exemplo de uma Simples Calculadora, feita em código HTML, com o Visual Studio Code.
- Código:
<meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Calculadora FMG SAMP</title> <style>
*{
margin: 0;
padding: 0;
}
.fundo{
background-image: linear-gradient(45deg,rgb(0, 38, 255), rgb(52, 168, 28));
height: 100vh;
color: #fff;
font-family: Arial, Helvetica, sans-serif;
text-align: center;
}
.calculadora{
position: absolute;
background-color: rgba(0, 17, 255, 0.8);
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
border-radius: 15px;
padding: 15px;
}
.botao{
width: 50px;
height: 50px;
font-size: 25px;
cursor: pointer;
margin: 3px;
background-color: rgb(51, 253, 0);
border: none;
color: rgb(2, 2, 2);
}
.botao:hover{
background-color: rgb(175, 233, 158);
}
#resultado{
background-color: rgb(169, 243, 140);
width: 207px;
height: 30px;
margin: 5px;
font-size: 25px;
color: black;
text-align: right;
padding: 5px;
}
h1 {
color: rgb(12, 12, 12);
}
#titlefmg {
color: rgb(9, 255, 0);
}
</style>
<div class="fundo">
<h1 id="titlefmg">
Familia Garcia SAMP
</h1>
<div class="calculadora">
<h1>
Calculadora
</h1>
<p id="resultado">
</p>
<table>
<tbody></tbody> <tbody></tbody>
<tr style="">
<td>
<button class="botao" onclick="clean()">
C
</button>
</td>
<td>
<button class="botao" onclick="back()">
<
</button>
</td>
<td>
<button class="botao" onclick="insert('/')">
/
</button>
</td>
<td>
<button class="botao" onclick="insert('*')">
X
</button>
</td>
</tr><tbody></tbody><tbody> </tbody> <tbody></tbody>
<tr style="">
<td>
<button class="botao" onclick="insert('7')">
7
</button>
</td>
<td>
<button class="botao" onclick="insert('8')">
8
</button>
</td>
<td>
<button class="botao" onclick="insert('9')">
9
</button>
</td>
<td>
<button class="botao" onclick="insert('-')">
-
</button>
</td>
</tr><tbody></tbody><tbody> </tbody> <tbody></tbody>
<tr style="">
<td>
<button class="botao" onclick="insert('4')">
4
</button>
</td>
<td>
<button class="botao" onclick="insert('5')">
5
</button>
</td>
<td>
<button class="botao" onclick="insert('6')">
6
</button>
</td>
<td>
<button class="botao" onclick="insert('+')">
+
</button>
</td>
</tr><tbody></tbody><tbody> </tbody> <tbody></tbody>
<tr style="">
<td>
<button class="botao" onclick="insert('1')">
1
</button>
</td>
<td>
<button class="botao" onclick="insert('2')">
2
</button>
</td>
<td>
<button class="botao" onclick="insert('3')">
3
</button>
</td>
<td rowspan="2">
<button class="botao" style="height: 106px;" onclick="calcular()">
=
</button>
</td>
</tr><tbody></tbody><tbody> </tbody> <tbody></tbody>
<tr style="">
<td colspan="2">
<button class="botao" style="width: 106px;" onclick="insert('0')">
0
</button>
</td>
<td>
<button class="botao" onclick="insert('.')">
.
</button>
</td>
</tr><tbody></tbody><tbody> </tbody>
</table>
</div>
</div>
<script>
function insert(num)
{
var numero = document.getElementById('resultado').innerHTML;
document.getElementById('resultado').innerHTML = numero + num;
}
function clean()
{
document.getElementById('resultado').innerHTML = "";
}
function back()
{
var resultado = document.getElementById('resultado').innerHTML;
document.getElementById('resultado').innerHTML = resultado.substring(0, resultado.length -1);
}
function calcular()
{
var resultado = document.getElementById('resultado').innerHTML;
if(resultado)
{
document.getElementById('resultado').innerHTML = eval(resultado);
}
else
{
document.getElementById('resultado').innerHTML = "Nada..."
}
}
</script>
HuemersonFMG- Fundador - ADM
- PublicaçõesPublicaçõesMembro VipMembro VipCriador de TópicosCriador de TópicosParticipação em tópicosParticipação em tópicosCriador de EventosCriador de EventosPopular no fórum - AmigosPopular no fórum - AmigosAvaliação de MSGAvaliação de MSGMelhores avaliações de AmigosMelhores avaliações de AmigosRei dos Grupos no FórumRei dos Grupos no FórumMelhor RPGRecebe este ao criar sua Ficha RPG no Perfil
- Mensagens : 506
Pontos : 26514
Reputação : 0
Data de inscrição : 11/06/2018
Idade : 51
Localização : Brasil
FMGRPG
FMG:
(200/100)
Tópicos semelhantes
» Simples Página de Login em HTML - Visual Studio Code
» Visual Studio Code
» HTML - Dicas interessantes
» Dicas da Microsoft - Criar um site simples usando HTML, CSS e JavaScript
» Para Baixar: Simples medidor de Memória do PC
» Visual Studio Code
» HTML - Dicas interessantes
» Dicas da Microsoft - Criar um site simples usando HTML, CSS e JavaScript
» Para Baixar: Simples medidor de Memória do PC
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
Qui 14 Mar 2024, 09:36 por HuemersonFMG
» Esqueceu o número do seu telefone?
Ter 05 Dez 2023, 12:51 por HuemersonFMG
» Scripts SQL - Oracle
Ter 05 Dez 2023, 11:56 por HuemersonFMG
» Dicas para Excel
Sex 27 Out 2023, 11:22 por HuemersonFMG
» Acentos e Caracteres Especiais em HTML
Sex 20 Out 2023, 13:17 por HuemersonFMG
» Dez motivos para consumir mais café...
Dom 27 Ago 2023, 05:09 por alfredw10
» Combinações de teclas do Windows
Dom 06 Ago 2023, 13:29 por HuemersonFMG
» PL/SQL - Extensão da linguagem SQL - Oracle
Qua 10 maio 2023, 10:16 por HuemersonFMG
» Node.js é uma tecnologia assíncrona
Ter 09 maio 2023, 11:21 por HuemersonFMG
» Pontos Cardeais
Seg 24 Abr 2023, 20:02 por HuemersonFMG
» 1º DE MAIO – DIA MUNDIAL DO TRABALHO
Seg 24 Abr 2023, 15:34 por HuemersonFMG
» ChatGPT - robô virtual (chatbot) que responde a perguntas variadas
Seg 20 Fev 2023, 11:23 por HuemersonFMG
» Simples Página de Login em HTML - Visual Studio Code
Seg 06 Fev 2023, 13:40 por HuemersonFMG
» HTML - Dicas interessantes
Qui 19 Jan 2023, 17:02 por HuemersonFMG
» https://phaser.io/ - para criar jogos HTML5
Ter 17 Jan 2023, 13:06 por HuemersonFMG