|
Home
|
|
Indice Javascript
|
Clock
Browser
Finestre
Status Bar
Background
Calcolatrici
Grafica ed Effetti
Convertitori
Utility
Form
Menu e Link
Super Calc v2.3
Super Calc v2.3
Best used with
Netscape Communicator 4.0
Scientific Notation:
Memory:
Special functions:
Mode:
Help
No Help
Powers:
Finding "x":
Fractions:
Misc:
Note: This script is NOT compatible with Microsoft's Internet Explorer 3.0
"The most powerful web-based calculator in the world"
by
Tom Richardson Jr.
Usa Copia e incolla questa è la sorgente
<SCRIPT language=JavaScript> /* ################################################################## # Copyright 1997(C) # Super Calc(R) v2.3 Calculator with # # Tom Richardson Jr. # a new built in version Equasion+(R) # # Richardson Technologies # Released 8-13-97 # # E-mail: ######################################## # gooftroop@geocities.com # # Web site: http://home.rmci.net/gooftroop # ################################################################## # I give you permission to utilize this script and all of it's # # components as long as this part stays intact and untouched. # # Using this script souly for making profit in any currency is # # strictly prohibited without the written permission of Tom # # Richardson Jr. # ################################################################## # Basicly, you have to have my written permission to use this # # script for making any money. # ################################################################## # This script is not compatible with Microsoft's Internet # # Explorer 3.0. # ################################################################## */ //start script //set variables //Note: this script is totally customizable from this function. function getinput(func) { var a = document.mainform.total; var b = document.mainform.memory1; var c = document.mainform.memory2; if (document.mainform.mode[0].checked) { var mode = 1 //help mode } else { var mode = 0 //non-help mode } if (func==power) { return power(mode, a) } if (func==equa) { return equa(mode) } if (func==spec) { return spec(mode, a) } if (func==cubed) { return cubed(mode, a) } if (func==squared) { return squared(mode, a) } if (func=="mem1") { return mem(mode, a, b) } if (func=="mem2") { return mem(mode, a, c) } if (func=="rcl1") { return rcl(mode, b, a) } if (func=="rcl2") { return rcl(mode, c, a) } if (func==logrythm) { return logrythm(mode, a) } if (func==sine) { return sine(mode, a) } if (func==cosine) { return cosine(mode, a) } if (func==tangent) { return tangent(mode, a) } if (func==squareroot) { return squareroot(mode, a) } if (func==fractions) { return fractions(mode, a) } if (func==negpos) { return negpos(mode, a) } if (func==mc) { return mc(mode, b, c) } if (func==scie) { return scie(mode, a) } if (func==unscie) { return unscie(mode, a) } } //enough variables //evaluate the value in the total textbox function calc(obj, objw) { if (objw.value=="") { objw.value='' } objw.value = eval(obj.value) } //add more characters to the total textbox function more(obj, where) { if (where.value=="" || where.value=="0") { where.value = obj } else { where.value += obj } } //clear the total textbox value and start with this new character function doit(obj, where) { where.value = obj } //clear the value function cleart(obj) { obj.value = '0' } //oops, backspace function less(obj) { obj.value = obj.value.substring(0, obj.value.length - 1) } //powers to any given number function power(mode, obj) { if (mode==1) { alert("Power allows you to give powers to any given number.") } if (obj.value!="" && obj.value!="0") { aa = prompt("Do you want to use the number in the total textbox as the base number?", "y or n"); if (aa=="y") { a = obj.value } else { a = prompt("Enter a base number:", "") } b = prompt("Enter an exponent:", ""); if (aa=="y") { doit(Math.pow(a, b), obj) } else { more('(' + Math.pow(a, b) + ')', obj) } } else { a = prompt("Enter a base:", ""); b = prompt("Enter an exponent:", ""); doit(Math.pow(a, b), obj) } } //solve for unknown variable ("x") in any given expression function equa(mode) { if (mode==1) { alert("Equasion\+ is a handy little tool that will solve for \"x\" in any expression. Ex: 5*x=10, it will alert you this: x=2. But, you have to tell it exactly what you want. Method is what property of math you will be using. Ex: addition, subtraction, division, or multiplication. Remember, *=multiplication, /=division, \+=addition, and -=subtraction.") } a = prompt("What method will you be using? Ex: \/, *, +, or -", ""); if (a=="/") { f = prompt("Is \"x\" being divided?", "y or n") if (f=="y") { b = prompt("\"x\" is being divided by what?", ""); c = prompt("And what is the answer?", ""); d = c*b; } else { b = prompt("What number is being divided by \"x\"?", ""); c = prompt("And what is the answer?", ""); d = b/c; } } if (a=="*") { b = prompt("What is being multiplied by \"x\"?", ""); c = prompt("And what is the answer?", ""); d = c/b; } if (a=="+") { b = prompt("What is being added to \"x\"?", ""); c = prompt("And what is the answer?", ""); d = c-b } if (a=="-") { f = prompt("Is \"x\" being subtracted?", "y or n") if (f=="y") { b = prompt("\"x\" is being subtracted from what?", ""); c = prompt("And what is the answer?", ""); d = b-c } else { b = prompt("What number is being subtracted from \"x\"?", ""); c = prompt("And what is the answer?", ""); d = (b*1)+(c*1) } } if (a=="") { d = 0 } alert("x = "+d+"") } //multiply any number by any number, any number of times function spec(mode, obj) { if (mode==1) { alert("Spec is handy tool that allows you to multiply a number by another number any number of times. It works kind of like powers, except the only difference is that in powers, you have multiply a number by itself any number of times. This function allows you to multiply any number by any number, any number of times.") } if (obj.value!="" && obj.value!="0") { aa = prompt("Do you want to use the number in the total textbox as the first number?", "y or n") if (aa=="y") { a = obj.value } else { a = prompt("A number please as the first number:", "") } b = prompt("And you want to multiply the number by what number?", ""); c = prompt("And how many times will you being multiplying the first by the second?", ""); d = Math.pow(b,c); if (aa=="y") { doit(a*d, obj) } else { more('(' + a*d + ')', obj) } } else { a = prompt("A number please as the first number:", ""); b = prompt("And you want to multiply the number by what number?", ""); c = prompt("And how many times will you being multiplying the first by the second?", ""); d = Math.pow(b,c); doit(a*d, obj) } } //cube any given number function cubed(mode, obj) { if (mode==1) { alert("Cubed allows you to cube any given number.") } if (obj.value!="" && obj.value!="0") { aa = prompt("Do you want to cube the current number in the total textbox?", "y or n"); if (aa=="y") { doit(Math.pow(obj.value, 3), obj) } else { a = prompt("Enter a number to cube:", ""); more('(' + Math.pow(a, 3) + ')', obj) } } else { a = prompt("Enter a number to cube:", ""); doit(Math.pow(a, 3), obj) } } //square any given number function squared(mode, obj) { if (mode==1) { alert("Squared allows you to square any given number") } if (obj.value!="" && obj.value!="0") { aa = prompt("Do you want to square the current number in the total textbox?", "y or n"); if (aa=="y") { doit(Math.pow(obj.value, 2), obj) } else { a = prompt("Enter a number to be squared:", ""); more('(' + Math.pow(a, 2) + ')', obj) } } else { a = prompt("Enter a number to square:", ""); doit(Math.pow(a, 2), obj) } } //store any number in memory function mem(mode, obj, where) { if (mode==1) { alert("Pressing the memory button allows you to save the current number in the total textbox for later use. You can Recall the remembered number by pressing the Rcl button.") } where.value = obj.value } //recall any numbers in memory function rcl(mode, obj, where) { if (mode==1) { alert("Rcl is a neat function that works with Memory. It recalls and gives you the number you saved in the coresponding memory.") } if (obj.value=="") { more('', where) } else { more('(' + obj.value + ')', where) } } //find the logarythm of any given number function logrythm(mode, obj) { if (mode==1) { alert("This function returns the natural logarythm of any given number") } if (obj.value!="" && obj.value!="0") { aa = prompt("Do you want to find the logarythm of the number in the total textbox?", "y or n"); if (aa=="y") { doit(Math.log(obj.value), obj) } else { a = prompt("Enter a number to find the logarythm of:", ""); more('(' + Math.log(a) + ')', obj) } } else { a = prompt("Enter a number to find the logarythm of:", ""); doit(Math.log(a), obj) } } //find the sine of any given number function sine(mode, obj) { if (mode==1) { alert("This function returns the sine of any given number") } if (obj.value!="" && obj.value!="0") { aa = prompt("Do you want to find the sine of the number in the total textbox?", "y or n"); if (aa=="y") { doit(Math.sin(obj.value), obj) } else { a = prompt("Enter a number to find the sine of:", ""); more('(' + Math.sin(a) + ')', obj) } } else { a = prompt("Enter a number to find the sine of:", ""); doit(Math.sin(a), obj) } } //find the cosine of any given number function cosine(mode, obj) { if (mode==1) { alert("This function returns the cosine of any given number") } if (obj.value!="" && obj.value!="0") { aa = prompt("Do you want to find the cosine of the number in the total textbox?", "y or n"); if (aa=="y") { doit(Math.cos(obj.value), obj) } else { a = prompt("Enter a number to find the cosine of:", ""); more('(' + Math.cos(a) + ')', obj) } } else { a = prompt("Enter a number to find the cosine of:", ""); doit(Math.cos(a), obj) } } //find the tangent of any given number function tangent(mode, obj) { if (mode==1) { alert("This function returns the tangent of any given number") } if (obj.value!="" && obj.value!="0") { aa = prompt("Do you want to find the tangent of the number in the total textbox?", "y or n"); if (aa=="y") { doit(Math.tan(obj.value), obj) } else { a = prompt("Enter a number to find the tangent of:", ""); more('(' + Math.tan(a) + ')', obj) } } else { a = prompt("Enter a number to find the tangent of:", ""); doit(Math.tan(a), obj) } } //find the squareroot of any given number function squareroot(mode, obj) { if (mode==1) { alert("This function gives you the square root of any given number") } if (obj.value!="" && obj.value!="0") { aa = prompt("Do you want to find the square root of the current number in the total text box?", "y or n"); if (aa=="y") { doit(Math.sqrt(obj.value), obj) } else { a = prompt("Enter a number to find the square root of:", ""); more('(' + Math.sqrt(a) + ')', obj) } } else { a = prompt("Enter a number to find the square root of:", ""); doit(Math.sqrt(a), obj) } } //fractions are cool............ function fractions(mode, obj) { if (mode==1) { alert("Frac is a neat function that allows you to input fractions. The script will automaticly convert the fraction you give into a decimal soit will understand it. Just make sure you know the math terms: in 2 and2 fifths, 2 is the base, the next 2 is the numerator, and 5 is the denominator. If there is no base number, leave the prompt box that asks for a base empty. Without a base you can just do simple fractions such as 2 fifths.") } if (obj.value!="" && obj.value!="0") { aa = prompt("Do you want to use the number in the total textbox as the base?", "y or n"); if (aa=="y") { a = obj.value } else { a = prompt("Enter a base:", ""); } b = prompt("Enter a numerator:", ""); c = prompt("Enter a denominator", ""); d = b/c; e = (d*1)+(a*1); if (aa=="y") { doit(e, obj) } else { more('(' + e + ')', obj) } } else { a = prompt("Enter a base:", ""); b = prompt("Enter a numerator:", ""); c = prompt("Enter a denominator:", ""); d = b/c; e = (d*1)+(a*1); doit(e, obj) } if (e=="nullNaN") { more("", obj) } if (e=="NaN") { more("", obj) } } //change the sign of any given number function negpos(mode, obj) { if (mode==1) { alert("+/- allows the you to convert a negative(-) number to a positive(+) and a positive number to a negative. And then it puts it in the total textbox with any other number that is already in there.") } obj.value *= (-1) } //clear any numbers in memory function mc(mode, obj1, obj2) { if (mode==1) { alert("Memory Clear is an easy little function that erases the values of both memorys.") } obj1.value = ''; obj2.value = '' } //convert any number into scientific notation function scie(mode, obj) { if (mode==1) { alert("Scie is cool function that allows you to convert any given number into scientific notation. The format of the answer is as follows: Ex: input:120, output:1.2*10^2, would be 1.2 multiplied by 10 to the second power.") } if (obj.value!="" && obj.value!="0") { aa = prompt("Do you want to convert the current number in the total textbox?", "y or n"); if (aa=="y") { a = obj.value } else { a = prompt("Enter a number to convert:", "") } } else { a = prompt("Enter a number to convert:", "") } var b = 0; while (a>10) { //divide by ten until variable is no longer greater han 10 a /= 10; b += 1 } doit(a + '*10^' + b, obj) } //convert any number out of scientific notation to standard form function unscie(mode, obj) { if (mode==1) { alert("UnScie does the exact opposite of Scie. It allows you to input number in scientific notation and it will output the number in standard notation. Ex: input:1.2*10^2, output:120") } a = prompt("Enter the number that is the decimal:", ""); b = prompt("Enter the power that is given to 10:", ""); c = Math.pow(10, b); d = a*c; if (obj.value!="" && obj.value!="0") { e = prompt("Do you want to use this result as a part of another calculation in the total textbox?", "y or n"); if (e=="y") { more('(' + d + ')', obj) } else { doit(d, obj) } } else { doit(d, obj) } } //HELP!! function helpround() { if (document.mainform.mode[0].checked) { alert("Round is an easy function that simply rounds the number in the total textbox to the nearest whole number.") } } function helppi () { if (document.mainform.mode[0].checked) { alert("PI is an easy function that just gives you PI. 3.14......") } } </SCRIPT> </head> <body> <FORM name=mainform> <CENTER> <TABLE border=0> <TBODY> <TR> <TD><CENTER><FONT color=red size=6> <B>Super Calc v2.3</b> </font><BR>Best used with <a href="http://www.netscape.com">Netscape Communicator 4.0</a> </CENTER></TR></TBODY></TABLE> <TABLE border=0 cellPadding=1 cellSpacing=10> <TBODY> <TR> <TD> <TABLE border=0 cellPadding=1 cellSpacing=1> <TBODY> <TR> <TD align=left><B>Scientific Notation:</B><BR><INPUT onclick=getinput(scie) type=button value=Scie> <INPUT onclick=getinput(unscie) type=button value=UnScie></TD> <TR> <TD align=left><B>Memory:</B><BR><INPUT onclick="getinput('mem1')" type=button value=" M1 "> <INPUT onclick="getinput('mem2')" type=button value=" M2 "> <INPUT onclick="getinput('rcl1')" type=button value=" Rcl1 "> <BR> <CENTER><INPUT onclick="getinput('rcl2')" type=button value=" Rcl2 "> <INPUT onclick=getinput(mc) type=button value=" MC "> </CENTER> <TR> <TD><B>Special functions:</B><BR><INPUT onclick=getinput(sine) type=button value=" sin "> <INPUT onclick=getinput(cosine) type=button value=" cos "> <INPUT onclick=getinput(tangent) type=button value=" tan "> <BR><INPUT onclick=getinput(logrythm) type=button value=" log "> <INPUT onclick=getinput(spec) type=button value=" Spec "> <INPUT onclick="helppi(); more('(' + Math.PI + ')', document.mainform.total)" type=button value=" PI "> </TR></TBODY></TABLE> <TD> <TABLE border=0 cellPadding=1 cellSpacing=1> <TBODY> <TR> <TD><B>Mode: <INPUT CHECKED name=mode type=radio>Help <INPUT name=mode type=radio>No Help</B> <TR> <TD><INPUT name=total size=15 value=0> <TD><INPUT onclick=cleart(document.mainform.total) type=button value=" C "> </TR></TBODY></TABLE> <TABLE border=0 cellPadding=0 cellSpacing=0> <TBODY> <TR> <TD><INPUT onclick="more(1, document.mainform.total)" type=button value=" 1 "> <TD><INPUT onclick="more(2, document.mainform.total)" type=button value=" 2 "> <TD><INPUT onclick="more(3, document.mainform.total)" type=button value=" 3 "> <TD><INPUT onclick="more(')', document.mainform.total)" type=button value=" ) "> <TD><INPUT onclick="more('+', document.mainform.total)" type=button value=" + "> <TR> <TD><INPUT onclick="more(4, document.mainform.total)" type=button value=" 4 "> <TD><INPUT onclick="more(5, document.mainform.total)" type=button value=" 5 "> <TD><INPUT onclick="more(6, document.mainform.total)" type=button value=" 6 "> <TD><INPUT onclick="more('(', document.mainform.total)" type=button value=" ( "> <TD><INPUT onclick="more('-', document.mainform.total)" type=button value=" - "> <TR> <TD><INPUT onclick="more(7, document.mainform.total)" type=button value=" 7 "> <TD><INPUT onclick="more(8, document.mainform.total)" type=button value=" 8 "> <TD><INPUT onclick="more(9, document.mainform.total)" type=button value=" 9 "> <TD><INPUT onclick="more('.', document.mainform.total)" type=button value=" . "> <TD><INPUT onclick="more('/', document.mainform.total)" type=button value=" / "> <TR> <TD><INPUT onclick=less(document.mainform.total) type=button value=" <-- "> <TD><INPUT onclick="more(0, document.mainform.total)" type=button value=" 0 "> <TD><INPUT onclick="calc(document.mainform.total, document.mainform.total)" type=button value=" = "> <TD><INPUT onclick=getinput(negpos) type=button value=" +/- "> <TD><INPUT onclick="more('*', document.mainform.total)" type=button value=" * "> </TR></TBODY></TABLE> <TD> <TABLE border=0 cellSpacing=1 cellpaddng="1"> <TBODY> <TR> <TD><B>Powers:</B><BR><INPUT onclick=getinput(squared) type=button value=" ^2 "> <INPUT onclick=getinput(cubed) type=button value=" ^3 "> <INPUT onclick=getinput(power) type=button value=" x^y "> <TR> <TD><B>Finding "x":</B><BR><INPUT onclick=getinput(equa) type=button value=Equasion+> <TR> <TD><B>Fractions:</B><BR><INPUT onclick=getinput(fractions) type=button value=Frac> <TR> <TD><B>Misc:</B><BR><INPUT onclick=getinput(squareroot) type=button value=Sqrt> <INPUT onclick="helpround(); doit(Math.round(document.mainform.total.value), document.mainform.total)" type=button value=Round> </TR></TBODY></TABLE></TR></TBODY></TABLE><BR><I><INPUT onclick="alert('Super Calc v2.3(R) with new more compact Equasion+(R). Both Copyright(C) and authored by Tom Richardson Jr of Richardson Technologies(R)')" type=button value=About> </I><BR> <FONT size=-50><FONT color=red><!---->Note: This script is NOT compatible with Microsoft's Internet Explorer 3.0</FONT><BR> "The most powerful web-based calculator in the world" <BR> <I>by <a href="http://home.rmci.net/gooftroop">Tom Richardson Jr.</a> <INPUT name=memory1 type=hidden> <input name=memory2 type=hidden> </i></font> </center></FORM> <p><center> <font face="Verdana" size="-2">Free JavaScripts da<br> <a href="http://www.massimo61.org/">Free Web Upgrade</a></font> </center><p>