welcome

Samuel's Blog

Rabu, 13 Mei 2009

Tu9a5 TIK CaLcuLatoR cuy !!!!!!

Inilah script dari program calculator sederhana,
enjoy it and check it out !!!!!!!!!!

Inget DbWhx ada pRogRamnyA j9 lwHo!!!

Ini sricpx :

<html><head><title>JS - Calculator</title>




<script language="Javascript">
<!--
/* Variablen definieren */
var plussign = ' + ';
var minussign = ' - ';
var multiplysign = ' * ';
var dividesign = ' / ';
var decimalsign = ' . ';
var negativesign = ' -';
var leftbracket = ' (';
var rightbracket = ') ';
var rad = 3.141592654 / 180;
var base_10 = Math.LN10;
var base_2 = Math.LN10;


function calculate(arg) {
arg.expr.value = eval(arg.expr.value)
}

function enter(arg, string) {
arg.expr.value += string
}

function clear_display(arg) {
arg.expr.value = ' '
}

function calc_sqrt(form) {
form.expr.value = (Math.sqrt(form.expr.value))
}

function calc_sqr(form) {
form.expr.value = ((form.expr.value * 1) * (form.expr.value * 1))
}

function sin_form(form) {
form.expr.value = (Math.sin (form.expr.value * rad))
}

function cos_form(form) {
form.expr.value = (Math.cos (form.expr.value * rad))
}

function tan_form(form) {
form.expr.value = (Math.tan(form.expr.value * rad))
}

function inverse(form) {
form.expr.value = ( 1 / (form.expr.value))
}

function base10_log(form) {
form.expr.value = (Math.log(form.expr.value) / base_10)
}

function base2_log(form) {
form.expr.value = (Math.log(form.expr.value) / base_2)
}
//-->
</script></head><body>
<p align="center"><big><big>JavaScript - Calculator SMANEKA</big></big></p>
<form>
<!-- Yup, Mulai -->
<table align="center" bgcolor="#cccccc" border="0" width="100">
<tbody><tr>
<td colspan="5" width="100%"><input name="expr" size="35" action="calculate(this.form)" type="text"></td>
</tr>
<tr>
<td width="20%"><input value=" sin " onclick="sin_form(this.form)" type="button"></td>
<td width="20%"><input value=" cos " onclick="cos_form(this.form)" type="button"></td>
<td width="20%"><input value=" tan " onclick="tan_form(this.form)" type="button"></td>
<td width="20%"><input value="log10e" onclick="base10_log(this.form)" type="button"></td>
<td width="20%"><input value=" log2e " onclick="base2_log(this.form)" type="button"></td>
</tr>
<tr>
<td width="20%"><input value=" Sqrt " onclick="calc_sqrt(this.form)" type="button"></td>
<td width="20%"><input value=" Sqr " onclick="calc_sqr(this.form)" type="button"></td>
<td width="20%"><input value=" ( " onclick="enter(this.form,
leftbracket)" type="button"></td>
<td width="20%"><input value=" ) " onclick="enter(this.form,
rightbracket)" type="button"></td>
<td width="20%"><input value=" 1 / X " onclick="inverse(this.form)" type="button"></td>
</tr>
<tr>
<td width="20%"><input value=" 7 " onclick="enter(this.form, 7)" type="button"></td>
<td width="20%"><input value=" 8 " onclick="enter(this.form, 8)" type="button"></td>
<td width="20%"><input value=" 9 " onclick="enter(this.form, 9)" type="button"></td>
<td colspan="2" width="40%"><input value=" C " onclick="clear_display(this.form)" type="button"></td>
</tr>
<tr>
<td width="20%"><input value=" 4 " onclick="enter(this.form, 4)" type="button"></td>
<td width="20%"><input value=" 5 " onclick="enter(this.form, 5)" type="button"></td>
<td width="20%"><input value=" 6 " onclick="enter(this.form, 6)" type="button"></td>
<td width="20%"><input value=" * " onclick="enter(this.form,
multiplysign)" type="button"> </td>
<td width="20%"> <input value=" / " onclick="enter(this.form,
dividesign)" type="button"></td>
</tr>
<tr>
<td width="20%"><input value=" 1 " onclick="enter(this.form, 1)" type="button"></td>
<td width="20%"><input value=" 2 " onclick="enter(this.form, 2)" type="button"></td>
<td width="20%"><input value=" 3 " onclick="enter(this.form, 3)" type="button"></td>
<td width="20%"><input value=" + " onclick="enter(this.form,
plussign)" type="button"> </td>
<td width="20%"> <input value=" - " onclick="enter(this.form,
minussign)" type="button">
</td>
</tr>
<tr>
<td width="20%"><input value=" 0 " onclick="enter(this.form, 0)" type="button"></td>
<td width="20%"><input value=" . " onclick="enter(this.form,
decimalsign)" type="button"></td>
<td width="20%"><input value=" neg " onclick="enter(this.form,
negativesign)" type="button"></td>
<td colspan="2" width="40%"><input value=" = " onclick="calculate(this.form)" type="button"></td>
</tr>
</tbody></table>
<!-- Bisa.... -->
</form>
</body></html>


Ini programnya :
JS - Calculator

JavaScript - Calculator SMANEKA





















































 

Template Design By:
SkinCorner
Gaara