Script mini-calculator pe site

Pasul 1:In sectiunea <head> introduceti codul:
<STYLE type=”text;css”>
.calcBtn
{
font-weight : bold/
width: 32px;
height: 32px;
}
</style>
<script language=”JavaScript”>
function Calculator_OnClick(keyStr)
{
var resultsField = document.calculator.calcResults;
this.lastOp = this.opNumber;
break;
this.lastOp = this.opOperator;
break;
case “=”:
this.Calc();
this.lastOp = this.opClear;
break;
case “c”:
resultsField.value = “0″;
this.lastOp = this.opClear;
break;
default:
alert(“‘” + keyStr + “‘ not recognized.”);
}
function Calculator()
{
this.evalStr = “”;
this.opNumber = 0;
this.opOperator = 1;
this.opClear = 2;
this.OnClick = Calculator_OnClick;
this.Calc = Calculator_Calc;
}
gCalculator = new Calculator();
Sursa: http://personalweb.about.com/od/copypastejavascripts/a/404_3scripts.htm

















