Advertisement
tegusta

Love Calculator javascript

Dec 2nd, 2012
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html>
  3.   <head>
  4.     <title>Calculator j</title>
  5.     <script>
  6.     var a=0, c=0;
  7.     function erase(){
  8.       if(a==1 && c==0){
  9.         calcola.inserisci.value=' '
  10.         a=0
  11.       }//if
  12.     }//erase
  13.   </script>
  14.   </head>
  15.   <body>
  16.   <form name="calcola">
  17.     <table style="border:7px solid;border-collapse:collapse">
  18.       <tr>
  19.         <td>
  20.           <input type="text" name="inserisci" Size="27px"><br/>
  21.         </td>
  22.       </tr>
  23.       <tr>
  24.         <td>
  25.           <input type="button" value="7" onclick="erase();calcola.inserisci.value+=7">
  26.           <input type="button" value="8" onclick="erase();calcola.inserisci.value+=8">
  27.           <input type="button" value="9" onclick="erase();calcola.inserisci.value+=9">
  28.           <input type="button" value="*" onclick="c=1;calcola.inserisci.value+='*'">
  29.           <input type="button" value="/" onclick="c=1;calcola.inserisci.value+='/'">
  30.           <br/>
  31.           <input type="button" value="4" onclick="erase();calcola.inserisci.value+=4">
  32.           <input type="button" value="5" onclick="erase();calcola.inserisci.value+=5">
  33.           <input type="button" value="6" onclick="erase();calcola.inserisci.value+=6">
  34.           <input type="button" value="+" onclick="c=1;calcola.inserisci.value+='+'">
  35.           <input type="button" value="-" onclick="c=1;calcola.inserisci.value+='-'">
  36.           <br/>
  37.           <input type="button" value="1" onclick="erase();calcola.inserisci.value+=1">
  38.           <input type="button" value="2" onclick="erase();calcola.inserisci.value+=2">
  39.           <input type="button" value="3" onclick="erase();calcola.inserisci.value+=3">
  40.           <input type="button" value=" fflush   " onclick="calcola.inserisci.value=' '">
  41.           <br/>
  42.           <input type="button" value="0" onclick="erase();calcola.inserisci.value+=0">
  43.           <input type="button" value=" .  " onclick="erase();calcola.inserisci.value+='.'">
  44.           <input type="button" value="=" onclick="calcola.inserisci.value=eval(calcola.inserisci.value);a=1;c=0">
  45.         </td>
  46.       </tr>
  47.     </table>
  48.   </form>
  49.   </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement