<br><div class="msgheader"> <div class="right"><span style="CURSOR: pointer" onclick="copycode(getid('phpcode31'));"><u>Salin kod</u></span></div>Kod adalah seperti berikut:</div> <div class="msgborder" id="phpcode31"> <br><!DOCTYPE html> <br><html> <br><meta name="content-type" content="text/html; charset=UTF-8"> <head> <br><title>Kalkulator</title> <br><!--Simpan kandungan utama sebagai rentetan dalam kotak teks Apabila butang adalah "=", panggil kaedah eval hasil dan kemudian Keluarkan hasil dalam kotak teks--> <br><script type="text/javascript"> { <br>str = document.getElementById("nummessege"); <br>str.value = str.value nums; <br>} <br>function onclickclear() { <br>str = document.getElementById("nummessege "); <br>str.value = ""; <br>} <br>function onclickresult() { <br>str = document.getElementById("nummessege"); <br>numresult = eval(str.value) ; <br>str .value = numresult; <br>} <br></skrip></head> -Tentukan jadual kunci, Setiap kekunci sepadan dengan pencetus peristiwa--> <br><table border="1" align="center" bgColor="#bbff77" <br />style="height: 350px; width: 270px"> <br><tr> <br><td colspan="4"> <br><input type="text" id="nummessege" <br />style="height: 90px; lebar: 350px; fon -saiz: 50px" /> <br></td> <br></tr> <br><tr> <br><td> <br><jenis input ="button" value ="1" id="1" onclick="onclicknum(1)" <br />style="height: 70px; width: 90px; font-size: 35px"> td> <br> <td> <br><input type="button" value="2" id="2" onclick="onclicknum(2)" <br />style="height: 70px; width: 90px; font-size : 35px"> <br></td> <br><td> <br><input type="button" value="3" id="3" onclick="onclicknum (3)" <br />style="height: 70px width: 90px; font-size: 35px"> <br></td> <br><td> <br><input type=" button" value=" " id="add" onclick="onclicknum(' ')" <br />style="height: 70px width: 90px"> <br></td> <br>< /tr> <br><tr><td> " <br>style ="height: 70px; width: 90px; font-size: 35px"> <br></td> <br><td> <br><input type="button" value ="5" id ="5" onclick="onclicknum(5)" <br>style="height: 70px; width: 90px; font-size: 35px"> <br></td> <td> <br><input type="button" value="6" id="6" onclick="onclicknum(6)" <br />style="height: 70px; width: 90px; font-size : 35px"> <br></td> <br><td> <br><input type="button" value="-" id="sub" onclick="onclicknum('-') " <br />style ="height: 70px; width: 90px; font-size: 35px"> <br></td> <br></tr> <br><tr> <br>< ;td> <br><input type="button" value="7" id="7" onclick="onclicknum(7)" <br />style="height: 70px; width: 90px; font-size: 35px"> <br></td> <br><td> <br><input type="button" value="8" id="8" onclick="onclicknum(8)" <br />style="height : 70px; width: 90px; font-size: 35px"> <br></td><td> <br><input type="button" value="9 " id="9 " onclick="onclicknum(9)" <br />style="height: 70px width: 90px"> <br></td> <br><td> ; <br>< ;input type="button" value="*" id="mul" onclick="onclicknum('*')" <br>style="height: 70px; width: 90px; font-size: 35px"> <br></td> <br></tr> <br><tr> <br><td colspan="2"> <br><input type="button " value="0 " id="0" onclick="onclicknum(0)" <br />style="height: 70px width: 190px"> <br></td> <br><td> ; <br /><input type="button" value="." id="point" onclick="onclicknum('.')" <br />style="height: 70px; width: 90px ; font-size: 35px"> <br></td> <br><td> <br><input type="button" value="/" id="division" <br />onclick= "onclicknum('/ ')" <br />style="height: 70px; width: 90px; font-size: 35px"> <br><br></tr> ;tr> <br><td colspan="2"> <br><input type="button" value="Del" id="clear" <br />onclick="onclickclear()" <br /> style="height: 70px; width: 190px; font-size: 35px" /> <br></td> <br><td colspan="2"> button" value=" =" id="result" <br>onclick="onclickresult()" <br>style="height: 70px; width: 190px; font-size: 35px" /> <br></td> <br><br></tr> <br><br></table> <br></badan> <br></html> <br> </div> <br><img src="http://files.jb51.net/file_images/article/201409/201409031736224.gif?201483173635" alt="">