kayaknya beberapa hari yl ada yg nanyain gimana buat penghitung pada homepage.
ini saya kasi sedikit contoh halaman html-nya
<html>
<head>
<title>Kalkulator</title>
<SCRIPT language=JavaScript>
<!-- Begin
function a_plus_b(form) {
a=eval(form.a.value)
b=eval(form.b.value)
c=a+b
form.ans.value = c
}
function a_minus_b(form) {
a=eval(form.a.value)
b=eval(form.b.value)
c=a-b
form.ans.value=c
}
function a_times_b(form) {
a=eval(form.a.value)
b=eval(form.b.value)
c=a*b
form.ans.value=c
}
function a_div_b(form) {
a=eval(form.a.value)
b=eval(form.b.value)
c=a/b
form.ans.value = c
}
function a_pow_b(form) {
a=eval(form.a.value)
b=eval(form.b.value)
c=Math.pow(a, b)
form.ans.value = c
}
// End -->
</SCRIPT>
</head>
<body>
<INPUT size=4
value=0 name=a><INPUT onclick=a_plus_b(this.form) type=button value=" +
"><INPUT onclick=a_minus_b(this.form) type=button value=" - "><INPUT
onclick=a_times_b(this.form) type=button value=" x "><INPUT
onclick=a_div_b(this.form) type=button value=" / "><INPUT onclick=a_pow_b(this.form)
type=button value=" ^ "><INPUT
type=number size=4 value=0 name=b> = <INPUT size=9 value=0 name=ans
?number?> <INPUT type=reset value=Reset name=B1>
</body>
</html>