※ 簡單計算機 ※
   加入網頁步驟  
 
  1. 將以下的控制碼先複製起來。(用滑鼠將底下的一堆碼,標記起來,按滑鼠右鍵選擇【複製】就行啦!)

  2. 然後在網頁中的 <BODY> 之後將剛剛複製的東西貼上就大功告成了  !(按滑鼠右鍵選擇【貼上】就行啦!)

Copyright Power Information All Rights Reserved.

※簡單計算機展示區※


<hr>
<form name="calc">
<div align="center"><center><table border="1" bgcolor="#99CCFF" bordercolor="#0000FF" bordercolorlight="#0000FF">
<tr>
<td colspan="5"><input type="text" size="14" name="result" value="_" onfocus="blur()"> </td>
</tr>
<tr>

<td><input type="button" name="1" value=" 1 " onclick="input(this.value)"></td>

<td><input type="button" name="2" value=" 2 " onclick="input(this.value)"></td>

<td><input type="button" name="3" value=" 3 " onclick="input(this.value)"></td>

<td><input type="button" name="CE" value=" CE " onclick="clearall()"></td>

<td><input type="button" name="C" value=" C " onclick="clearnow()"></td>

</tr>

<tr>

<td><input type="button" name="4" value=" 4 " onclick="input(this.value)"></td>

<td><input type="button" name="5" value=" 5 " onclick="input(this.value)"></td>

<td><input type="button" name="6" value=" 6 " onclick="input(this.value)"></td>

<td><input type="button" name="sing" value=" +/- " onclick="change()"></td>

<td><input type="button" name="=" value=" = " onclick="operate(this.value)"></td>

</tr>

<tr>

<td><input type="button" name="7" value=" 7 " onclick="input(this.value)"></td>

<td><input type="button" name="8" value=" 8 " onclick="input(this.value)"></td>

<td><input type="button" name="9" value=" 9 " onclick="input(this.value)"></td>

<td><input type="button" name="+" value=" + " onclick="operate(this.value)"></td>

<td><input type="button" name="-" value=" - " onclick="operate(this.value)"></td>

</tr>

<tr>

<td colspan="2"><input type="button" name="0" value=" 0 " onclick="input(this.value)"></td>

<td><input type="button" name="." value=" . " onclick="point()"></td>

<td><input type="button" name="*" value=" * " onclick="operate(this.value)"></td>

<td><input type="button" name="/" value=" / " onclick="operate(this.value)"></td>

</tr>

</table>

</center></div>

</form>



<hr>

<font color="#FFFFFF"><script language="JavaScript">

<!-- hide script from old browser

var answer=0

var lastvalue=0

var op="+"

var lastop="+"

var newnumber=true



function input(digit){

if (op==" = ")

clearall()

if ((!newnumber)&&(document.calc.result.value!="0"))

document.calc.result.value+=eval(digit)

else

document.calc.result.value=""+eval(digit)

newnumber=false

}



function clearnow(){

document.calc.result.value="_"

newnumber=true

}



function clearall(){

answer=0

lastop="+"

op="+"

clearnow()

}



function operate(operation){

if ((newnumber!=true)||(op==" = "))

{

answer=""+answer

if ((operation!=" = ") && (op!=" = "))

{

lastvalue=document.calc.result.value

lastop=op

answer=eval(answer+lastop+lastvalue)

document.calc.result.value=answer

}

else if (operation==" = ")

{

if (op!=" = ")

{

lastop=op

lastvalue=document.calc.result.value

}

answer=eval(answer+lastop+lastvalue)

document.calc.result.value=answer

}

newnumber=true

}

op=operation

}



function change(){

answer=-1*document.calc.result.value

document.calc.result.value=answer

}



function point(){

if (!newnumber)

{

number=document.calc.result.value

if (number.indexOf('.')==-1)

document.calc.result.value+="."



}

// end hiding -->

</script></font>