mi codigo actual es el siguiente:
Código Javascript:
Ver original
<html> <head> <script language="Javascript"> function fcero(){document.f1.numr.value=document.f1.numr.value+0;} function funo(){document.f1.numr.value=document.f1.numr.value+1;} function fdos(){document.f1.numr.value=document.f1.numr.value+2;} function ftres(){document.f1.numr.value=document.f1.numr.value+3;} function fcuatro(){document.f1.numr.value=document.f1.numr.value+4;} function fcinco(){document.f1.numr.value=document.f1.numr.value+5;} function fseis(){document.f1.numr.value=document.f1.numr.value+6;} function fsiete(){document.f1.numr.value=document.f1.numr.value+7;} function focho(){document.f1.numr.value=document.f1.numr.value+8;} function fnueve(){document.f1.numr.value=document.f1.numr.value+9;} function fopera(){ var op=document.f1.numr.value; var a=parseInt(document.f1.numr.value); var b=parseInt(document.f1.nuevo.value); if(op=="+"){ var a=+b; document.f1.numr.value=a; } if(op=="-"){ var resul=a-b; document.f1.numr.value=resul; } } function fcalcular(){document.f1.numr.value=document.f1.nuevo.value;document.f1.nuevo.value="";} </script> </head> <body> <form name="f1" action="calculadora.html" method=GET> <table border=1> <tr><td colspan=3><label name="lblnum"></label><input type="text" name="numr"></td></tr> <input type="text" name="nuevo" value=""> <tr><td><input type=button name="n1" value=" 1 " onclick="funo()"></td><td><input type=button name="n2" value=" 2 "onclick="fdos()"></td><td><input type=button name="num" value=" 3 "onclick="ftres()"></td> <td><input type=button value=" + "onclick="fopera()"></td></tr> <tr><td><input type=button name="n4" value=" 4 "onclick='fcuatro()'></td><td><input type=button name="cinco" value=" 5 "onclick='fcinco()'></td><td><input type=button name="seis"value=" 6 "onclick='fseis()'></td><td><input type=button value=" - "onclick='fopera()'></td></tr> <tr><td><input type=button name="n7" value=" 7 "onclick='fsiete()'></td><td><input type=button name="n8" value=" 8 "onclick='focho()'></td><td><input type=button name="n9" value=" 9 "onclick='fnueve()'></td><td><input type=button value=" x "onclick='fopera()'></td></tr> <tr><td><input type=reset name="x" value=" c "></td><td><input type=button value=" 0 " name="n0" onclick="fcero()"></td><td><input type=button name="igual" value=" = "onclick="fcalcular()"></td><td><input type=button value=" / "onclick="fopera()"></td></tr> </form> </table> </body> </html>
Muchas gracias de antemano.y que paseis una Feliz Navidad