사이트 내 전체검색
공학용 계산기
https://cmd.kr/javascript/283 URL이 복사되었습니다.

본문

<style>
<!--
.button1 {COLOR: #FFFFFF; BACKGROUND-COLOR: #666666; HEIGHT: 25 px; WIDTH: 40px}
.button2 {COLOR: #FFFFFF; BACKGROUND-COLOR: #9F0004; HEIGHT: 25 px; WIDTH: 40px}
.button3 {COLOR: #FFFFFF; BACKGROUND-COLOR: #000000; HEIGHT: 25 px; WIDTH: 40px}
.button4 {COLOR: #FFFFFF; BACKGROUND-COLOR: #333333; HEIGHT: 25 px; WIDTH: 40px}
.button5 {COLOR: #B3B300; BACKGROUND-COLOR: #000000; HEIGHT: 25 px; WIDTH: 40px}
//-->
</style>
<SCRIPT LANGUAGE="JavaScript">
function doit() {
form.input.value = eval(form.input.value)
}

function Cos() {
x = form.input.value
if (x == '') alert('오류 : INPUT이 비었습니다.');
else form.input.value = Math.cos(x);
}

function Sin() {
x = form.input.value
if (x == '') alert('오류 : INPUT이 비었습니다.');
else form.input.value = Math.sin(x);
}

function Ln() {
x = form.input.value
if (x == '') alert('오류 : INPUT이 비었습니다.');
else form.input.value = Math.log(x);
}

function Root() {
x = form.input.value
if (x == '') alert('오류 : INPUT이 비었습니다.');
else form.input.value = Math.sqrt(x);
}

function Tan() {
x = form.input.value
if (x == '') alert('오류 : INPUT이 비었습니다.');
else form.input.value = Math.tan(x);
}

function Icos() {
x = form.input.value
if (x == '') alert('오류 : INPUT이 비었습니다.');
else form.input.value = Math.acos(x);
}

function Isin() {
x = form.input.value
if (x == '') alert('오류 : INPUT이 비었습니다.');
else form.input.value = Math.asin(x);
}

function Itan() {
x = form.input.value
if (x == '') alert('오류 : INPUT이 비었습니다.');
else form.input.value = Math.atan(x);
}

function Round() {
x = form.input.value
if (x == '') alert('오류 : INPUT이 비었습니다.');
else form.input.value = Math.round(x);
}

function Ran() {
x = form.input.value
form.input.value = Math.random(x);
}

function Neg () {
x = form.input.value
if (x == '') alert('오류 : INPUT이 비었습니다.');
else x = parseFloat(x) * -1;
}

function del() {
x = form.input.value
x = (x.substring) - 1
}
//-->
</script>

<title>공학용 계산기</title>
<BODY onLoad="document.form.input.focus();">

<form name="form" method="post" action="javascript:doit()">
<table border="1" width="310" height="260">
<tr>
<td align="center">
<table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0" bgcolor="#000000">
<tr>
<td colspan="3" width="100%" align="center">
<font size="4" face="Arial" color="#FFFFFF"><b>Advanced Scientific Calculator</b></font>
</td>
</tr>
<tr>
<td colspan="3" width="100%" align="center">
<input type="text"  name="input" size="40">
</td>
</tr>
<tr>
<td width="47%" align="center">
<input type="button" name="one" value="1" onClick="form.input.value += '1'" class="button1">
<input type="button" name="two" value="2" onClick="form.input.value += '2'" class="button1">
<input type="button" name="three" value="3" onClick="form.input.value += '3'" class="button1"><br>
<input type="button" name="four" value="4" onClick="form.input.value += '4'" class="button1">
<input type="button" name="five" value="5" onClick="form.input.value += '5'" class="button1">
<input type="button" name="six" value="6" onClick="form.input.value += '6'" class="button1"><br>
<input type="button" name="seven" value="7" onClick="form.input.value += '7'" class="button1">
<input type="button" name="eight" value="8" onClick="form.input.value += '8'" class="button1">
<input type="button" name="nine" value="9" onClick="form.input.value += '9'" class="button1"><br>
<input type="button" name="zero" value="0" onClick="form.input.value += '0'" class="button1">
<input type="button" name="point" value="." onClick="form.input.value += '.'" class="button1">
<input type="button" name="pi" value="PI" onClick="form.input.value += '3,1415926535897932384626433832795'" class="button1">
</td>
<td width="6%"> </td>
<td width="47%" align="center">
<input type="button" name="clear" value="C" onClick="form.input.value = ''" class="button2">
<input type="button" name="percent" value=" % " onClick="form.input.value = eval(form.input.value) / 100" class="button3">
<input type="button" name="(" value=" ( " onClick="form.input.value += '('" class="button3"><br>
<input type="button" name="times" value="  x  " onClick="form.input.value += ' * '" class="button3">
<input type="button" name="div"  value="  /  " onClick="form.input.value += ' / '" class="button3">
<input type="button" name=")" value=" ) " onClick="form.input.value += ')'" class="button3"><br>
<input type="button" name="plus"  value="  +  " onClick="form.input.value += ' + '" class="button3">
<input type="button" name="minus" value="  -  " onClick="form.input.value += ' - '" class="button3">
<input type="button" name="round" value="Rnd" onClick="Round()" class="button3"><br>
<input type="button" name="pi2" value="+/-" onClick="Neg()" class="button3">
<input type="button" name="DoIt"  value=" = " onClick="doit()" class="button3">
<input type="button" name="round2" value="Ran#" onClick="Ran()" class="button3">
</td>
</tr>
<tr>
<td colspan="3" width="100%"> </td>
</tr>
<tr>
<td width="47%" align="center">
<input type="button" name="quad" value="^2" onClick="form.input.value = form.input.value * form.input.value" class="button4">
<input type="button" name="root" value="root" onClick="Root()" class="button4">
<input type="button" name="ln" value="ln" onClick="Ln()" class="button4"><br>
<input type="button" name="sin" value="sin" onClick="Sin()" class="button4">
<input type="button" name="cos" value="cos" onClick="Cos()" class="button4">
<input type="button" name="tan" value="tan" onClick="Tan()" class="button4"><br>
<input type="button" name="sin2" value="asin" onClick="Isin()" class="button4">
<input type="button" name="cos2" value="acos" onClick="Icos()" class="button4">
<input type="button" name="tan2" value="atan" onClick="Itan()" class="button4">
</td>
<td width="6%"> </td>
<td width="47%" align="center">
<input type="button" name="1/2" value="1/2" onClick="form.input.value += '0.5'" class="button5">
<input type="button" name="1/3" value="1/3" onClick="form.input.value += '0.3333333333'" class="button5">
<input type="button" name="1/4" value="1/4" onClick="form.input.value += '0.25'" class="button5"><br>
<input type="button" name="1/5" value="1/5" onClick="form.input.value += '0.2'" class="button5">
<input type="button" name="1/6" value="1/6" onClick="form.input.value += '0.1666666667'" class="button5">
<input type="button" name="1/7" value="1/7" onClick="form.input.value += '0.1428571429'" class="button5"><br>
<input type="button" name="1/8" value="1/8" onClick="form.input.value += '0.125'" class="button5">
<input type="button" name="1/9" value="1/9" onClick="form.input.value += '0.1111111111'" class="button5">
<input type="button" name="1/10" value="1/10" onClick="form.input.value += '0.1'" class="button5">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>

출처 : http://www.aircon1004.com/data/bbs/board.php?bo_table=pds1&wr_id=95

댓글목록

등록된 댓글이 없습니다.

831 (10/17P)

Search

Copyright © Cmd 명령어 3.145.161.194