Skip to content

Instantly share code, notes, and snippets.

@thams017
Last active March 4, 2016 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thams017/11c5786da46b90843bf8 to your computer and use it in GitHub Desktop.
Save thams017/11c5786da46b90843bf8 to your computer and use it in GitHub Desktop.
Calculator
function one ()
{
var res = document.getElementById( "text" );
res.value += '1';
}
function two ()
{
var res = document.getElementById( "text" );
res.value += '2';
}
function three ()
{
var res = document.getElementById( "text" );
res.value += '3';
}
function four ()
{
var res = document.getElementById( "text" );
res.value += '4';
}
function five ()
{
var res = document.getElementById( "text" );
res.value += '5';
}
function six ()
{
var res = document.getElementById( "text" );
res.value += '6';
}
function seven ()
{
var res = document.getElementById( "text" );
res.value += '7';
}
function eight ()
{
var res = document.getElementById( "text" );
res.value += '8';
}
function nine ()
{
var res = document.getElementById( "text" );
res.value += '9';
}
function zero ()
{
var res = document.getElementById( "text" );
res.value += '0';
}
function reset ()
{
var res = document.getElementById( "text" );
res.value = "";
}
function add ()
{
var res = document.getElementById( "text" );
res.value += '+';
}
function sub ()
{
var res = document.getElementById( "text" );
res.value += '-';
}
function mul ()
{
var res = document.getElementById( "text" );
res.value += '*';
}
function div ()
{
var res = document.getElementById( "text" );
res.value += '/';
}
function dot ()
{
var res = document.getElementById( "text" );
res.value += '.';
}
function openBrace ()
{
var res = document.getElementById( "text" );
res.value += '(';
}
function closeBrace ()
{
var res = document.getElementById( "text" );
res.value += ')';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment