Membuat kalkulator dan Kalender dengan PHP


Berikut ini script membuat kalkulator yang di kombinasi dengan kalender

<html>
<head>
<title> MY DESIGN </title>
</head>
<body background=”images/paper.jpg”>

<marquee behavior=”scroll” direction=”right”><font size=”5″ face=”Backslash”>duniagama.wordpress.com</font></marquee><br><br>

<table><b><table border=4 width=50 height=60 cellpadding=2 cellspacing=6>
<tr> <td colspan=3 align=middle>
<li id=”calendar”><h2            >Calender</h2>
<div id=”calendar_wrap”><table id=”wp-calendar” summary=”Kalender”>
<h1 align=”center”><font size=”12″face=”Angie BareFoot”color=”black”> April 2012 </font>
<head>
<tr>

<th =”Senin” scope=”col” title=”Senin”>S</th>
<th =”Selasa” scope=”col” title=”Selasa”>S</th>

<th =”Rabu” scope=”col” title=”Rabu”>R</th>
<th =”Kamis” scope=”col” title=”Kamis”>K</th>
<th =”Jumat” scope=”col” title=”Jumat”>J</th>
<th =”Sabtu” scope=”col” title=”Sabtu”>S</th>
<th =”Minggu” scope=”col” title=”Minggu”>M</th>
</tr>

</head>

<body>
<tr>
<td colspan=”4″>&nbsp;</td><td><td><td><b><font color=”red”>1</font></td></td></td>
</tr>
<tr>
<td>2</td><td>3</td><td>4</td><td>5</td><td><b><font color=”red”>6</font></td><td>7</td><td><b><font color=”red”>8</font></td>

</tr>
<tr>
<td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td><td><b><font color=”red”>15</font></td>
</tr>
<tr>
<td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td><td><b><font color=”red”>22</font></td>
</tr>
<tr>
<td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td><td><b><font color=”red”>29</font></td>
</tr>
<tr>
<td>30</td>
</tr>
</body>
</table></div></li>

<center>
<form name=”Keypad” action=””>
<table> <b><table border=2 width=50 height=60 cellpadding=1 cellspacing=5>
<tr> <td colspan=3 align=middle>
<input name=”ReadOut”type=”Text” size=24 value=”0″ width=100%>
</TD><TD
</TD>
<td>
<input name=”btnClear” type=”Button” value=” C ” onclick=”Clear()”>
</TD>
<td> <input name=”btnClearEntry” type=”Button” value=” CE ” onclick=”ClearEntry()”>
</TD>
</TR>
<tr>
<td>
<input name=”btnSeven” type=”Button” value=” 7 ” onclick=”NumPressed(7)”>
</TD>
<td>
<input name=”btnEight” type=”Button” value=” 8 ” onclick=”NumPressed(8)”>
</TD>
<td>
<input name=”btnNine” type=”Button” value=” 9 ” onclick=”NumPressed(9)”>
</TD>
<td>
</TD>
<td>
<input name=”btnNeg” type=”Button” value=” +/- ” onclick=”Neg()”>
</TD>
<td>
<input name=”btnPercent” type=”Button” value=” % ” onclick=”Percent()”>
</TD>
</TR>
<tr>
<td>
<input name=”btnFour” type=”Button” value=” 4 ” onclick=”NumPressed(4)”>
</TD>
<td>
<input name=”btnFive” type=”Button” value=” 5 ” onclick=”NumPressed(5)”>
</TD>
<td>
<input name=”btnSix” type=”Button” value=” 6 ” onclick=”NumPressed(6)”>
</TD>
<td>
</TD>
<td align=middle> <input name=”btnPlus” type=”Button”” value=” + ” onclick=”Operation(‘+’)”>
</TD>
<td align=middle> <input name=”btnMinus” type=”Button”value=” – ” onclick=”Operation(‘-‘)”>
</TD>
</TR>
<tr>
<td>
<input name=”btnOne” type=”Button” value=” 1 “onclick=”NumPressed(1)”>
</TD>
<td>
<input name=”btnTwo” type=”Button” value=” 2 ” onclick=”NumPressed(2)”>
</TD>
<td>
<input name=”btnThree” type=”Button” value=” 3 ” onclick=”NumPressed(3)”>
</TD>
<td>
</TD>
<td align=middle> <input name=”btnMultiply” type=”Button” value=” * ” onclick=”Operation(‘*’)”>
</TD>
<td align=middle> <input name=””btnDivide” type=”Button” value=” / ” onclick=”Operation(‘/’)”>
</TD>
</TR>
<tr>
<td>
<input name=”btnZero” type=”Button” value=” 0 ” onclick=”NumPressed(0)”>
</TD>
<td>
<input name=”btnDecimal” type=”Button” value=” . ” onclick=”Decimal()”>
</TD>
<td colspan=3>
</TD>
<td>
<input name=”btnEquals” type=”Button” value=” = ” onclick=”Operation(‘=’)”>
</TD>
</TR>
</TABLE> </TABLE></B>
</FORM> </CENTER>
<font face=”Verdana, Arial, Helvetica” size=2>
<script LANGUAGE=”JavaScript”>
<!– Begin
var FKeyPad = document.Keypad;
var Accum = 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 )
Accum += parseFloat(Readout);
else if ( ‘-‘ == PendingOp )
Accum -= parseFloat(Readout);
else if ( ‘/’ == PendingOp )
Accum /= parseFloat(Readout);
else if ( ‘*’ == PendingOp )
Accum *= parseFloat(Readout);
else
Accum = parseFloat(Readout);
FKeyPad.ReadOut.value = Accum;
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 () {
Accum = 0;
PendingOp = “”;
ClearEntry();
}
function Neg () {
FKeyPad.ReadOut.value = parseFloat(FKeyPad.ReadOut.value) * -1;
}
function Percent () {
FKeyPad.ReadOut.value = (parseFloat(FKeyPad.ReadOut.value) / 100) * parseFloat(Accum);
}

</SCRIPT>
</body>
</html>

Advertisements

2 thoughts on “Membuat kalkulator dan Kalender dengan PHP

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s