<html> <head> <title>Calculadora</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- .borda { border: 0.8px ridge #333333; background-color: #FFCC00; } --></style> <script language="JavaScript"> <!-- var num1; var num2; var op; function manda_visor(num) { document.calc.Visor.value += Str(num); } function ponto() { if(document.calc.Visor.indexof('.')== -1) { document.calc.Visor.value = str(document.calc.Visor.value) + '.'; } } function zero() { if(document.calc.Visor.value.indexof(".") != -1 || (document.calc.Visor.length == 1 && document.calc.Visor.value == '0')) document.calc.Visor.value = str(document.calc.Visor.value) + '0'; } function operacao(oper) { op=oper; if(num1==0) { num1 = double(document.calc.Visor.value); document.calc.Visor.value = ""; } else { num2 = double(document.calc.Visor.value); document.calc.Visor.value = ""; } } function igual() { if(op == "soma") { document.calc.Visor.value=""; document.calc.Visor.value = num1 + num2; }else if(op == "sub") { document.calc.Visor.value=""; document.calc.Visor.value = num1 - num2; }else if(op == "divisao") { document.calc.Visor.value=""; document.calc.Visor.value = num1 / num2; }else { document.calc.Visor.value=""; document.calc.Visor.value = num1 * num2; } } //--> </script> </head> <body> <form action="" method="post" name="calc" id="calc"> <p> </p> <table width="20%" border="0" align="center" cellpadding="1" cellspacing="1" class="borda"> <tr> <td colspan="4"><input name="Visor" type="text" id="Visor" size="18"></td> </tr> <tr> <td><input name="7" type="button" id="7" value="7" onclick="manda_visor(7)"></td> <td><input name="8" type="button" id="8" value="8" onclick="manda_visor(8)"> </td> <td><input name="9" type="button" id="9" value="9" onclick="manda_visor(9)"> </td> <td><input name="menos" type="submit" id="menos" value="- " onclick="operacao('sub')"></td> </tr> <tr> <td><input name="4" type="button" id="4" value="4" onclick="manda_visor(4)"></td> <td><input name="5" type="button" id="5" value="5" onclick="manda_visor(5)"></td> <td><input name="6" type="button" id="62" value="6" onclick="manda_visor(6)"></td> <td><input name="mais" type="button" id="mais" value="+" width="10" onclick="operacao('soma')"></td> </tr> <tr> <td><input name="1" type="button" id="12" value="1" onclick="manda_visor(1)"></td> <td><input name="2" type="button" id="22" value="2" onclick="manda_visor(2)"></td> <td><input name="3" type="button" id="32" value="3" onclick="manda_visor(3)"></td> <td><input name="divide" type="button" id="divide2" value="/ " onclick="operacao('divisao')"></td> </tr> <tr> <td><input name="0" type="button" id="02" value="0" onclick="zero()"></td> <td><input name="ponto" type="button" id="ponto" value="." onclick="ponto()"></td> <td><input name="igual" type="button" id="igual2" value="=" onclick="igual()"></td> <td><input name="multiplica" type="button" id="multiplica2" value="x" onclick="operacao('multiplicar')"></td> </tr> </table> </form> </body> </html>
Erro em código JS...
Started By
Juliano.net
, 08/12/2002, 20:57
2 replies to this topic
#1
Posted 08/12/2002, 20:57
Qual o erro neste código???
Não perca as dicas de meu blog em: http://www.julianonunes.com - São centenas de posts com conteúdo técnico.
Ganhe Um Voucher De Certificação! Acessem meu blog, no endereço http://julianonetfox.spaces.live.com/blog/...!1265.entry e vejam as instruções para concorrer a um dos vouchers.
Ganhe Um Voucher De Certificação! Acessem meu blog, no endereço http://julianonetfox.spaces.live.com/blog/...!1265.entry e vejam as instruções para concorrer a um dos vouchers.
#2
Posted 09/12/2002, 08:37
Erro no script
Linha: 21
Caractere: 1
Erro: makeCoolMenu não está definido
Linha: 21
Caractere: 1
Erro: makeCoolMenu não está definido
Attached Files
Fritsche
#3
Posted 09/12/2002, 08:39
DESCULPE.... POSTEI ERRADO !!!!!!!!!!!!!
Fritsche
0 user(s) are reading this topic
0 membro(s), 0 visitante(s) e 0 membros anônimo(s)