โค้ดเครื่องคิดเลข2


เครื่องคิดเลข (Calculator)








<div id="demo">
  <form onsubmit="calculate(); return false;">
  <div id="calculator" class="drag">
    <div class="calculatorcontainer">
      <div id="version">เครื่องคิดเลข (Calculator)</div>
      <div id="control"><a href="#" onclick="about();return false">
        <img src="ตำแหน่งของภาพ calq.gif" width="16" height="16" /></a> <a href="#" onclick="closeCalculator();return false">
        <img src="ตำแหน่งของภาพ calclose.gif" style="position:relative;top:-1px" width="13" height="13"/></a></div>
      <input type="text" name="input" size="16" id="result" onclick="this.focus()" onkeyup="addToCalcDirect(this.value)"><br />
      <input type="button" value="1" onclick="addToCalc(this.value)"><input type="button" value="2" onclick="addToCalc(this.value)"><input type="button" value="3" onclick="addToCalc(this.value)"><input type="button" value="+" onclick="addToCalc(this.value)" class="operation"><br />
      <input type="button" value="4" onclick="addToCalc(this.value)"><input type="button" value="5" onclick="addToCalc(this.value)"><input type="button" value="6" onclick="addToCalc(this.value)"><input type="button" value="-" onclick="addToCalc(this.value)" class="operation"><br />
      <input type="button" value="7" onclick="addToCalc(this.value)"><input type="button" value="8" onclick="addToCalc(this.value)"><input type="button" value="9" onclick="addToCalc(this.value)"><input type="button" value="*" onclick="addToCalc(this.value)" class="operation"><br />
      <input type="button" value="+/-" onclick="positiveNegative()" class="operation"><input type="button" value="0" onclick="addToCalc(this.value)"><input type="button" value="." onclick="addToCalc(this.value)" class="operation"><input type="button" value="/" onclick="addToCalc(this.value)" class="operation"><br />
      <input type="button" value="sqrt" onclick="squareRoot()" class="operation"><input type="button" value="%" onclick="percentage()" class="operation"><input type="button" value="c" onclick="resetCalc()" class="operation"><input type="button" value="=" onclick="calculate()" class="equals">
    </div>
  </div>
  </form>
</div>

วันนี้