Total members 11872 |It is currently Fri Jan 27, 2023 1:29 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





This is easy to understand JavaScript calculator
Code:
<html>  
   <
head>
  <
title>calculator based on javascript.</title>
    </
head>
  <
form name="board" id="board">  
     <
input type="text"  id="resultsbox" style="text-align:center;background:white;" disabled="disabled">  
    </
form>  
      
    <
table>  
 
     <
tr>  
      <
td><input type="button" value="7" onclick="board.resultsbox.value += '7'"></td>  
      <
td><input type="button" value="8" onclick="board.resultsbox.value += '8'"></td>  
      <
td><input type="button" value="9" onclick="board.resultsbox.value += '9'"></td>  
      <
td rowspan="2"><input type="button" onclick="board.resultsbox.value += '+'" style="height: 60px;" value ="+"></td>  
     </
tr>  
     <
tr>  
      <
td><input type="button" value="4" onclick="board.resultsbox.value += '4'"></td>  
      <
td><input type="button" value="5" onclick="board.resultsbox.value += '5'"></td>  
      <
td><input type="button" value="6" onclick="board.resultsbox.value += '6'"></td>  
     </
tr>  
     <
tr>  
      <
td><input type="button" value="1" onclick="board.resultsbox.value += '1'"></td>  
      <
td><input type="button" value="2" onclick="board.resultsbox.value += '2'"></td>  
      <
td><input type="button" value="3" onclick="board.resultsbox.value += '3'"></td>  
      <
td rowspan="3">
      <
input type="button" onclick="board.resultsbox.value = eval(board.resultsbox.value)" style="height: 80px;" value ="="></td>  
     </
tr>  
     <
tr>  
      <
td><input type="button"   value="0" onclick="board.resultsbox.value += '0'"></td>  
      <
td><input type="button" value="."  style="width: 100%" onclick="board.resultsbox.value += '.' "></td>  
      <
td><input type="button" value="-"   onclick="board.resultsbox.value += '-'" ></td
     </
tr>  
         <
tr>  
      <
td><input type="button" value="C"   onclick="board.resultsbox.value = ''"></td>  
      <
td><input type="button" value="/"   onclick="board.resultsbox.value += '/'"></td>  
      <
td><input type="button" value="x"   onclick="board.resultsbox.value += 'x'"></td>  
 
     </
tr>  
    </
table>  
    
</
html>
 




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Simple JavaScript calculator
 Simple Calculator     -  
 simple javascript calendar     -  
 Calculator     -  
 C++ Calculator     -  
 Calculator     -  
 C++ calculator with modification.     -  
 Scientific Calculator     -  
 Build Calculator in OpenGL     -  
 Complex numbers calculator (C++)     -  
 Making calculator in JAVA     -  



Topic Tags

JavaScript Variables, JavaScript Events






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com