קוד HTML:<script language="JavaScript"> function compute(obj) {obj.expr.value = eval(obj.expr.value)} var one = '1' var two = '2' var three = '3' var four = '4' var five = '5' var six = '6' var seven = '7' var eight = '8' var nine = '9' var zero = '0' var plus = '+' var minus = '-' var multiply = '*' var divide = '/' var decimal = '.' function enter(obj, string) {obj.expr.value += string} function clear(obj) {obj.expr.value = ''} </script> </p> <form name="calc"> <div align="center"><center><table border="1" bgcolor="#004B97" bordercolor="#C3FADA"> <TBODY> <tr> <td colspan="4"><p align="center"><input type="text" size="30" style="background-color: #fcffff; color: #000000;" name="expr" action="compute(this.form)"> </p> </td> </tr> <tr> <td><p align="center"><input type="button" value=" 7 " onclick="enter(this.form, seven)"> </p> </td> <td><p align="center"><input type="button" value=" 8 " onclick="enter(this.form, eight)"> </p> </td> <td><p align="center"><input type="button" value=" 9 " onclick="enter(this.form, nine)"> </p> </td> <td><p align="center"><input type="button" value=" / " onclick="enter(this.form, divide)"> </p> </td> </tr> <tr> <td><p align="center"><input type="button" value=" 4 " onclick="enter(this.form, four)"> </p> </td> <td><p align="center"><input type="button" value=" 5 " onclick="enter(this.form, five)"> </p> </td> <td><p align="center"><input type="button" value=" 6 " onclick="enter(this.form, six)"> </p> </td> <td><p align="center"><input type="button" value=" x " onclick="enter(this.form, multiply)"> </p> </td> </tr> <tr> <td><p align="center"><input type="button" value=" 1 " onclick="enter(this.form, one)"> </p> </td> <td><p align="center"><input type="button" value=" 2 " onclick="enter(this.form, two)"> </p> </td> <td><p align="center"><input type="button" value=" 3 " onclick="enter(this.form, three)"> </p> </td> <td><p align="center"><input type="button" value=" - " onclick="enter(this.form, minus)"> </p> </td> </tr> <tr> <td colspan="2"><p align="center"><input type="button" value=" 0 " onclick="enter(this.form, zero)"> </p> </td> <td><p align="center"><input type="button" value=" . " onclick="enter(this.form, decimal)"> </p> </td> <td><p align="center"><input type="button" value=" + " onclick="enter(this.form, plus)"> </p> </td> </tr> <tr> <td colspan="2"><p align="center"><input type="button" value=" = " onclick="compute(this.form)"> </p> </td> <td colspan="2"><p align="center"><font face="Ms Sans Serif"> <input type="reset" value=" נקה " onclick="clear(this.form)"></font></p> </td> </tr> </TBODY> </table> </center></div> </form>









:40ee:
