<!DOCTYPE html>
<html>
<head>
<title>Simple Calculator</title>
<link rel="stylesheet" href="css/index.css"/>
<link rel="stylesheet" href="jquery/css/jquery.mobile-1.4.2.min.css" type="text/css"/>
<script src="jquery/jquery-1.11.0.min.js" type ="text/javascript" charset="utf-8"></script>
<script src="jquery/jquery.mobile-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div data-role="page" id="mainpage">
<div data-role="panel" id="mypanel" data-position="right" data-display="overlay" >
<a href="#my-header" class="ui-btn ui-btn-inline ui-mini ui-corner-all" data-rel="close">Close panel</a>
<a href="#aboutpage" class="ui-btn ui-btn-inline ui-mini ui-corner-all">About</a>
<a href="#settingspage" class="ui-btn ui-btn-inline ui-mini ui-corner-all">Settings</a>
</div>
<div data-role="header" data-position="fixed">
<h1>Calculator</h1>
<a href="#mypanel" class="ui-btn-right ui-btn ui-btn-inline ui-mini ui-corner-all ui-btn-icon-right ui-icon-bars">Menu</a>
</div>
<div role="main" class="ui-content">
<FORM name="Keypad" action="">
<input name="ReadOut" type="Text" size=24 value="0" width=100%>
<input id="btnC" type="Button" value=" C " onclick="Clear()">
<input id="btnCE" type="Button" value=" CE " onclick="ClearEntry()">
<input id="btn7" type="Button" value=" 7 " onclick="NumPressed(7)">
<input id="btn8" type="Button" value=" 8 " onclick="NumPressed(8)">
<input id="btn9" type="Button" value=" 9 " onclick="NumPressed(9)">
<input id="btn+/-" type="Button" value=" +/- " onclick="Neg()">
<input id="btn%" type="Button" value=" % " onclick="Percent()">
<input id="btn4" type="Button" value=" 4" onclick="NumPressed(4)">
<input id="btn5" type="Button" value=" 5 "onclick="NumPressed(5)">
<input id="btn6" type="Button" value=" 6 " onclick="NumPressed(6)">
<input id="btn+" type="Button" value=" + " onclick="Operation('+')">
<input id="btn-" type="Button" value=" - " onclick="Operation('-')">
<input id="btn1" type="Button" value=" 1 " onclick="NumPressed(1)">
<input id="btn2" type="Button" value=" 2 " onclick="NumPressed(2)">
<input id="btn3" type="Button" value=" 3 " onclick="NumPressed(3)">
<input id="btn*" type="Button" value=" * " onclick="Operation('*')">
<input id="btn/" type="Button" value=" / " onclick="Operation('/')">
<input id="btn0" type="Button" value=" 0 " onclick="NumPressed(0)">
<input id="btn." type="Button" value=" . " onclick="Decimal()">
<input id="btn=" type="Button" value=" = " onclick="Operation('=')">
</FORM>
</div>
</div>
<div data-role="page" class="aboutpage">
<div data-role="header" data-position="fixed">
<h1>Calculator</h1>
<a href="#mainpage" class="ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all ui-btn-icon-left ui-icon-back">Back</a>
</div>
<div role="main" class="ui-content">
TegTech 2014
</div>
</div>
<div data-role="page" class="settingspage">
<div data-role="header" data-position="fixed">
<h1>Calculator</h1>
<a href="#mainpage" class="ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all ui-btn-icon-left ui-icon-back">Back</a>
</div>
<div role="main" class="ui-content">
</div>
</div>
</body>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var FKeyPad = document.Keypad;
var Accumulate = 0;
var FlagNewNum = false;
var PendingOp = "";
function NumPressed (Num) {
if (FlagNewNum) {
FKeyPad.ReadOut.value = Num;
FlagNewNum = false;
}
else {
if (FKeyPad.ReadOut.value == "0")
FKeyPad.ReadOut.value = Num;
else
FKeyPad.ReadOut.value += Num;
}
}
function Operation (Op) {
var Readout = FKeyPad.ReadOut.value;
if (FlagNewNum && PendingOp != "=");
else
{
FlagNewNum = true;
if ( '+' == PendingOp )
Accumulate += parseFloat(Readout);
else if ( '-' == PendingOp )
Accumulate -= parseFloat(Readout);
else if ( '/' == PendingOp )
Accumulate /= parseFloat(Readout);
else if ( '*' == PendingOp )
Accumulate *= parseFloat(Readout);
else
Accumulate = parseFloat(Readout);
FKeyPad.ReadOut.value = Accumulate;
PendingOp = Op;
}
}
function Decimal () {
var curReadOut = FKeyPad.ReadOut.value;
if (FlagNewNum) {
curReadOut = "0.";
FlagNewNum = false;
}
else
{
if (curReadOut.indexOf(".") == -1)
curReadOut += ".";
}
FKeyPad.ReadOut.value = curReadOut;
}
function ClearEntry () {
FKeyPad.ReadOut.value = "0";
FlagNewNum = true;
}
function Clear () {
Accumulate = 0;
PendingOp = "";
ClearEntry();
}
function Neg () {
FKeyPad.ReadOut.value = parseFloat(FKeyPad.ReadOut.value) * -1;
}
function Percent () {
FKeyPad.ReadOut.value = (parseFloat(FKeyPad.ReadOut.value) / 100) * parseFloat(Accumulate);
}
// End -->
</SCRIPT>
<script type="text/javascript">
app.initialize();
</script>
</html>