Ir para conteúdo
Fórum Script Brasil

hidan

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Tudo que hidan postou

  1. hidan

    Calculadora

    Olá, sou novo em programação e preciso fazer um trabalho de uma calculadora gráfica, no entanto não estou a conseguir.. Será que alguém me pode ajudar? :/ não consigo introduzir esses botões : com (% (percentagem), sqrt (raíz quadrada), x2 (x ao quadrado), xy (x elevado a y), módulo x%y (resto da divisão de um numero x por y) Tenho que usar javascript e html básico porque não aprendi outro, o que eu fiz ate agora foi o seguinte: <html> <head> <title>Calculadora</title> <body> Calculadora Grafica <form name="cal"> <table border=9 width="100"> <tr> <td colspan="4"><input type="text" name="vidro" /></td> </tr> <!-- So para separar --> <tr> <td align="center"><input type="button" value="1" onclick="botoes(value )"> </td> <td align="center"><input type="button" value="4" onclick="botoes(value )"> </td> <td align="center"><input type="button" value="7" onclick="botoes(value )"> </td> <td align="center"><input type="button" name="sinais" value="+" onclick="botoes(value )"> </td> <td align="center"><input type="button" name="sinais" value="√" onclick=" "> </td> </tr> <!-- So para separar --> <tr> <td align="center"><input type="button" value="2" onclick="botoes(value )"> </td> <td align="center"><input type="button" value="5" onclick="botoes(value )"> </td> <td align="center"><input type="button" value="8" onclick="botoes(value )"> </td> <td align="center"><input type="button" name="sinais" value="-" onclick="botoes(value )"> </td> </tr> <!-- So para separar --> <tr> <td align="center"><input type="button" value="3" onclick="botoes(value )"> </td> <td align="center"><input type="button" value="6" onclick="botoes(value )"> </td> <td align="center"><input type="button" value="9" onclick="botoes(value )"> </td> <td align="center"><input type="button" name="sinais" value="*" onclick="botoes(value )"> </td> </tr> <!-- So para separar --> <tr> <td align="center"><input type="button" value="0" onclick="botoes(value )" /> </td> <td align="center"><input type="button" value="/" onclick="botoes(value )" /> </td> <td align="center"><input type='reset' value='R' /></td> <td align="center"><input type="Button" name="" value== onclick="vidro.value=eval(vidro.value)"> </td> </tr> </form> <script> function botoes(variavel) { var juntar=cal.vidro.value; cal.vidro.value= juntar + variavel; } </script> </body> </html>
×
×
  • Criar Novo...