メイン JavaScriptCalculator.html Last modified: Sep 01, 2009
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html;CHARSET=EUC-JP">
<link rel="shortcut icon" href="../favicon.ico">
<TITLE>JavaScript Calculator</TITLE>
<script src="gxp.js">document.write("gxp.js ファイルが見つかりません??<br>")</script>
<script src="pxg.js">document.write("pxg.js ファイルが見つかりません??<br>")</script>
<script src="xxp.js">document.write("xxp.js ファイルが見つかりません??<br>")</script>
<script src="pxx.js">document.write("pxx.js ファイルが見つかりません??<br>")</script>
<script src="txp.js">document.write("txp.js ファイルが見つかりません??<br>")</script>
<script src="pxt.js">document.write("pxt.js ファイルが見つかりません??<br>")</script>
<script src="fxp.js">document.write("fxp.js ファイルが見つかりません??<br>")</script>
<script src="pxf.js">document.write("pxf.js ファイルが見つかりません??<br>")</script>
<script src="fac.js">document.write("fac.js ファイルが見つかりません??<br>")</script>
<script src="com.js">document.write("com.js ファイルが見つかりません??<br>")</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
var M0, M1, M2, M3, M4, M5, M6, M7, M8
var hex = 0
var hexstring="0123456789ABCDEF"
var PI = pi = Math.PI
var EXP = Math.E
var clf = 0
function conv16(ans)
{
var rem
if (ans == 0) {
return "0x"
}
else {
rem = ans % 16
return conv16(Math.floor(ans/16)) + hexstring.substring(rem, rem+1)
}
}
function conv8(ans)
{
var rem
if (ans == 0) {
return "0"
}
else {
rem = ans % 8
return conv8(Math.floor(ans/8)) + hexstring.substring(rem, rem+1)
}
}
function calc(ch)
{
var ans
if (clf) {
document.form1.text1.value = ""
clf = 0
}
if (ch == "=") {
ans = eval(document.form1.text1.value)
M0 = document.form1.text1.value = ans
if (hex == 1 && ans > 0 && Math.round(ans) == ans) {
document.form1.text1.value += " = " + conv16(ans)
document.form1.text1.value += " = " + conv8(ans)
}
clf = 1
}
else if (ch == "Clear") {
document.form1.text1.value = ""
}
else if (ch == "HEX") {
hex = 1-hex
}
else if (ch == "M0") {
document.form1.text1.value += M0
}
else {
if (ch == "←") {
ch = "="
}
document.form1.text1.value += ch
}
}
function sin(x)
{
return Math.sin(x)
}
function cos(x)
{
return Math.cos(x)
}
function tan(x)
{
return Math.tan(x)
}
function asin(x)
{
return Math.asin(x)
}
function acos(x)
{
return Math.acos(x)
}
function atan(x)
{
return Math.atan(x)
}
function exp(x)
{
return Math.exp(x)
}
function log(x)
{
return Math.log(x)
}
function log10(x)
{
return Math.log(x)/Math.log(10)
}
function sqrt(x)
{
return Math.sqrt(x)
}
function pow(x,y)
{
return Math.pow(x,y)
}
function nrt(x,n)
{
return Math.pow(x,1/n)
}
function rad(x)
{
return x/180*pi
}
function deg(x)
{
return x/pi*180
}
function fixed(x)
{
var d = 5
return Math.round(x*Math.pow(10,d))/Math.pow(10,d)
}
function z2p(x)
{
return fixed(gxp(x))
}
function p2z(x)
{
return fixed(pxg(x))
}
function x2p(x,i)
{
return fixed(xxp(x,i))
}
function p2x(x,i)
{
return fixed(pxx(x,i))
}
function t2p(x,i)
{
return fixed(txp(x,i))
}
function p2t(x,i)
{
return fixed(pxt(x,i))
}
function f2p(x,i,j)
{
return fixed(fxp(x,i,j))
}
function p2f(x,i,j)
{
return fixed(pxf(x,i,j))
}
// --> JavaScript対応ブラウザでないと動作しません。
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<font color="#ff0000" size="+2">以下のプログラムのサポートは終了しました。自己責任でお使い下さい。</font>
<form name="form1">
<table>
<caption><font size="+2"><b>JavaScript Calculator</b></font> Last modified: Jun 01, 2006</caption>
<tr><td align=center colspan=10 bgcolor="#ff8aeb"><input NAME="text1" VALUE="" SIZE=70></td></tr>
<tr>
<td align=center bgcolor="#cfffeb"><input type="button" VALUE="M0 " onClick="calc('M0')"></td>
<td align=center bgcolor="#cfffeb"><input type="button" VALUE="M1 " onClick="calc('M1')"></td>
<td align=center bgcolor="#cfffeb"><input type="button" VALUE="M2 " onClick="calc('M2')"></td>
<td align=center bgcolor="#cfffeb"><input type="button" VALUE="M3 " onClick="calc('M3')"></td>
<td align=center bgcolor="#cfffeb"><input type="button" VALUE="M4 " onClick="calc('M4')"></td>
<td align=center bgcolor="#cfffeb"><input type="button" VALUE="M5 " onClick="calc('M5')"></td>
<td align=center bgcolor="#cfffeb"><input type="button" VALUE="M6 " onClick="calc('M6')"></td>
<td align=center bgcolor="#cfffeb"><input type="button" VALUE="M7 " onClick="calc('M7')"></td>
<td align=center bgcolor="#cfffeb"><input type="button" VALUE="M8 " onClick="calc('M8')"></td>
<td align=center bgcolor="#cfffeb"><input type="button" VALUE=" ← " onClick="calc('←')"></td>
</tr>
<tr>
<td align=center><input type="button" VALUE=" A " onClick="calc('A')"></td>
<td align=center><input type="button" VALUE=" B " onClick="calc('B')"></td>
<td align=center><input type="button" VALUE=" C " onClick="calc('C')"></td>
<td align=center><input type="button" VALUE=" D " onClick="calc('D')"></td>
<td align=center><input type="button" VALUE=" E " onClick="calc('E')"></td>
<td align=center><input type="button" VALUE=" F " onClick="calc('F')"></td>
<td align=center><input type="button" VALUE=" X " onClick="calc('X')"></td>
<td align=center><input type="button" VALUE=" HEX " onClick="calc('HEX')"></td>
<td align=center><input type="button" VALUE=" π " onClick="calc('PI')"></td>
<td align=center><input type="button" VALUE=" e " onClick="calc('EXP')"></td>
</tr>
<tr>
<td align=center><input type="button" VALUE=" 7 " onClick="calc('7')"></td>
<td align=center><input type="button" VALUE=" 8 " onClick="calc('8')"></td>
<td align=center><input type="button" VALUE=" 9 " onClick="calc('9')"></td>
<td align=center><input type="button" VALUE=" * " onClick="calc('*')"></td>
<td align=center><input type="button" VALUE=" sin " onClick="calc('sin(')"></td>
<td align=center><input type="button" VALUE=" asin " onClick="calc('asin(')"></td>
<td align=center><input type="button" VALUE=" exp " onClick="calc('exp(')"></td>
<td align=center><input type="button" VALUE=" pow " onClick="calc('pow(')"></td>
<td align=center><input type="button" VALUE=" z2p " onClick="calc('z2p(')"></td>
<td align=center><input type="button" VALUE=" p2z " onClick="calc('p2z(')"></td>
</tr>
<tr>
<td align=center><input type="button" VALUE=" 4 " onClick="calc('4')"></td>
<td align=center><input type="button" VALUE=" 5 " onClick="calc('5')"></td>
<td align=center><input type="button" VALUE=" 6 " onClick="calc('6')"></td>
<td align=center><input type="button" VALUE=" / " onClick="calc('/')"></td>
<td align=center><input type="button" VALUE=" cos " onClick="calc('cos(')"></td>
<td align=center><input type="button" VALUE=" acos " onClick="calc('acos(')"></td>
<td align=center><input type="button" VALUE=" log " onClick="calc('log(')"></td>
<td align=center><input type="button" VALUE="log10" onClick="calc('log10(')"></td>
<td align=center><input type="button" VALUE=" x2p " onClick="calc('x2p(')"></td>
<td align=center><input type="button" VALUE=" p2x " onClick="calc('p2x(')"></td>
</tr>
<tr>
<td align=center><input type="button" VALUE=" 1 " onClick="calc('1')"></td>
<td align=center><input type="button" VALUE=" 2 " onClick="calc('2')"></td>
<td align=center><input type="button" VALUE=" 3 " onClick="calc('3')"></td>
<td align=center><input type="button" VALUE=" − " onClick="calc('-')"></td>
<td align=center><input type="button" VALUE=" tan " onClick="calc('tan(')"></td>
<td align=center><input type="button" VALUE=" atan " onClick="calc('atan(')"></td>
<td align=center><input type="button" VALUE=" √ " onClick="calc('sqrt(')"></td>
<td align=center><input type="button" VALUE=" fac " onClick="calc('fac(')"></td>
<td align=center><input type="button" VALUE=" t2p " onClick="calc('t2p(')"></td>
<td align=center><input type="button" VALUE=" p2t " onClick="calc('p2t(')"></td>
</tr>
<tr>
<td align=center><input type="button" VALUE=" 0 " onClick="calc('0')"></td>
<td align=center><input type="button" VALUE=" . " onClick="calc('.')"></td>
<td align=center><input type="button" VALUE=" , " onClick="calc(',')"></td>
<td align=center><input type="button" VALUE=" + " onClick="calc('+')"></td>
<td align=center><input type="button" VALUE=" rad " onClick="calc('rad(')"></td>
<td align=center><input type="button" VALUE=" deg " onClick="calc('deg(')"></td>
<td align=center><input type="button" VALUE=" n√ " onClick="calc('nrt(')"></td>
<td align=center><input type="button" VALUE=" com" onClick="calc('com(')"></td>
<td align=center><input type="button" VALUE=" f2p " onClick="calc('f2p(')"></td>
<td align=center><input type="button" VALUE=" p2f " onClick="calc('p2f(')"></td>
</tr>
<tr>
<td align=center><input type="button" VALUE="( " onClick="calc('(')"></td>
<td align=center><input type="button" VALUE=" )" onClick="calc(')')"></td>
<td align=center colspan=2><input type="button" VALUE="Clear" onClick="calc('Clear')"></td>
<td align=center colspan=4 bgcolor="#ffcfeb"><input type="button" VALUE="♪ A ns w e r ♪" onClick="calc('=')"></td>
</tr>
</table>
</form>
<p><hr noshade>
<img src="../gra/button3.png" width=9 height=9 alt="・"> <a href="exa/JSC.html">使用法</a> <a href="src/calc.html"><img src="png/src.png" width=35 height=11 alt="src" align=top></a><br>
<img src="../gra/button3.png" width=9 height=9 alt="・"> <A HREF="javascript:history.go(-1)">直前のページへ戻る</A> <img src="../gra/button3.png" width=9 height=9 alt="・"> <a href="../mail.html">E-mail to Shigenobu AOKI</a>
<p><center><IMG SRC="../gra/ume5.png" width=121 height=37 ALT="Made with Macintosh"></center>
</body>
</html>
サブ gxp.js Last modified: Mar 25, 2004
サブ pxg.js Last modified: Mar 25, 2004
サブ xxp.js Last modified: Mar 25, 2004
サブ pxx.js Last modified: Mar 25, 2004
サブ txp.js Last modified: Mar 25, 2004
サブ pxt.js Last modified: Mar 25, 2004
サブ fxp.js Last modified: Mar 25, 2004
サブ pxf.js Last modified: Mar 25, 2004
サブ fac.js Last modified: Mar 25, 2004
サブ com.js Last modified: Mar 25, 2004
直前のページへ戻る E-mail to Shigenobu AOKI