0 |
7 |
8 |
9 |
/ |
4 |
5 |
6 |
* |
1 |
2 |
3 |
- |
0 |
+/- |
. |
+ | |
| |
<TABLE style="BORDER-LEFT-COLOR: black; BORDER-BOTTOM-COLOR: black; BORDER-TOP-COLOR: black; BORDER-RIGHT-COLOR: black" onclick=previouskey=event.srcElement.innerText cellSpacing=0 cellPadding=0 width=200 bgColor=#000000 border=2> <TBODY> <TR> <TD id=result style="FONT: bold 20px Verdana; COLOR: black; TEXT-ALIGN: right" width="100%" bgColor=#ffffff>0</TD></TR> <TR> <TD vAlign=center align=middle width="100%"> <TABLE style="FONT: bold 20px Verdana; COLOR: white" cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD align=middle width="80%"> <TABLE onselectstart="return false" onmouseover="if (event.srcElement.tagName=='TD')event.srcElement.style.color='yellow'" style="FONT: bold 20px Verdana; CURSOR: hand; COLOR: white" onclick=calculate() onmouseout="event.srcElement.style.color='white'" height=82 cellSpacing=0 cellPadding=0 width="100%" border=1> <TBODY> <TR> <TD align=middle width="25%" height=17>7</TD> <TD style="COLOR: white" align=middle width="25%" height=17>8</TD> <TD style="COLOR: white" align=middle width="25%" height=17>9</TD> <TD style="COLOR: white" align=middle width="25%" height=17>/</TD></TR> <TR> <TD align=middle width="25%" height=19>4</TD> <TD align=middle width="25%" height=19>5</TD> <TD align=middle width="25%" height=19>6</TD> <TD align=middle width="25%" height=19>*</TD></TR> <TR> <TD style="COLOR: white" align=middle width="25%" height=19>1</TD> <TD style="COLOR: white" align=middle width="25%" height=19>2</TD> <TD style="COLOR: white" align=middle width="25%" height=19>3</TD> <TD style="COLOR: white" align=middle width="25%" height=19>-</TD></TR> <TR> <TD align=middle width="25%" height=19>0</TD> <TD onclick=pn();previouskey=1;event.cancelBubble=true align=middle width="25%" height=19>+/-</TD> <TD align=middle width="25%" height=19>.</TD> <TD align=middle width="25%" height=19>+</TD></TR></TBODY></TABLE></TD> <TD width="20%"> <DIV align=left> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=1> <TBODY> <TR> <TD style="FONT: bold 20px Verdana; CURSOR: hand; COLOR: white; TEXT-ALIGN: center" onclick="result.innerText=0;results=''" width="100%">C</TD></TR></TBODY></TABLE></DIV> <DIV align=left> <TABLE height=81 cellSpacing=0 cellPadding=0 width="100%" border=1> <TBODY> <TR> <TD onmouseover="event.srcElement.style.color='yellow'" style="FONT: bold 32px Verdana; CURSOR: hand; COLOR: white; TEXT-ALIGN: center" onclick=calculateresult() onmouseout="event.srcElement.style.color='white'" width="100%">=</TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE> <SCRIPT language=JavaScript1.2>
/* DHTML Calculator Script- © Dynamic Drive (www.dynamicdrive.com) For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use, visit dynamicdrive.com */
var results='' var previouskey='' var re=/(\/|\*|\+|-)/ var re2=/(\/|\*|\+|-){2}$/ var re3=/.+(\/|\*|\+|-).+/ var re4=/\d|\./ var re5=/^[^\/\*\+].+\d$/ var re6=/\./
function calculate(){ if (event.srcElement.tagName=="TD"){ if (event.srcElement.innerText.match(re4)&&previouskey=="=") results='' if (result.innerText.match(re3)&&event.srcElement.innerText.match(re)){ if (!results.match(re5)){ result.innerText="Error!" return } results=eval(results) if (results.toString().length>=12&&results.toString().match(re6)) results=results.toString().substring(0,12) result.innerText=results }
results+=event.srcElement.innerText if (results.match(re2)) results=results.substring(0,results.length-2)+results.charAt(results.length-1)
result.innerText=results } }
function calculateresult(){ if (!results.match(re5)){ result.innerText="Error!" return } results=eval(results) if (results.toString().length>=12&&results.toString().match(re6)) results=results.toString().substring(0,12) result.innerText=results }
function pn(){ if (result.innerText.charAt(0)!='-') result.innerText=results='-'+result.innerText else if (result.innerText.charAt(0)=='-') result.innerText=results=result.innerText*(-1) }
</SCRIPT>
|