»
Tiếng AnhTiếng PhápTiếng Việt

In - Máy tính cao cấp - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Tính toán » Máy tính » Máy tính cao cấp
URL: https://www.javascriptbank.com/scientific-calculator-2.html

Máy tính cao cấp © JavaScriptBank.comHiệu ứng tạo một máy tính đa chức năng.

Phiên bản đầy đủ: jsB@nk » Tính toán » Máy tính » Máy tính cao cấp
URL: https://www.javascriptbank.com/scientific-calculator-2.html



CSS
<style>.number_button{background: rgb(222, 222, 222) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 12pt; height: 32px; width: 38px;}.func_button{background: rgb(205, 205, 205) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 10pt; height: 28px; width: 38px;}.func_button2{background: rgb(238, 238, 238) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 10pt; height: 32px; width: 38px;}</style><style><!--a:link {color: #0000CC; text-decoration: none}a:visited {color: #0000CC; text-decoration: none} a:hover {color: #123456; text-decoration: none}body, td, th {font-family: "Arial", "Verdana"; font-size: 10pt}--></style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script language="javascript"><!--var broj = "0"var tocka = 0var eksp = 0var eksponent = 3var rjesenje = 0var decimala = 0var enter = "";function memory(operator) {document.racunalo.zadatak.focus();if (operator == 1) {// MS document.racunalo.memorija.value = document.racunalo.rezultat.value}else if (operator == 2){// MRvar memorija = document.racunalo.memorija.value;if (memorija==0 || slovo(memorija.charAt(0))) {memorija = ""};document.racunalo.zadatak.value += memorija}else if (operator == 3) {// CLSif (document.racunalo.zadatak.value == "") {document.racunalo.rezultat.value = ""}else {document.racunalo.zadatak.value = ""}}}function display(noviznak) {if (noviznak==""){document.racunalo.zadatak.focus()}else{document.racunalo.rezultat.select()}}function dodajBroj(noviznak) {document.racunalo.zadatak.focus();document.racunalo.zadatak.value += noviznak}function izracunaj(zarez) {var pitanje = "";var mem = 0;if (zarez >= 1) {if (document.racunalo.zadatak.value == "") {broj = document.racunalo.rezultat.value}else { broj = document.racunalo.zadatak.value;if (ubacirezultat(broj.charAt(0))) {broj = document.racunalo.rezultat.value + broj}}}for (var i=0; i<broj.length; i++) {if (broj.charAt(i) == ",") {pitanje += "."}else if (broj.charAt(i) == " ") {}else {pitanje += broj.charAt(i)}}if (operator(broj.charAt(broj.length-1))) {return false};pitanje = eval("1*" + pitanje);if (zarez > 1) {pitanje = matematika(zarez, pitanje)}document.racunalo.oldrezultat.value = pitanje;zaokruzi(pitanje);document.racunalo.zadatak.value = "";document.racunalo.zadatak.focus()}function matematika(zarez, rjesenje) {with (Math){if (zarez == 2) {rjesenje = pow(rjesenje, 2)}else if (zarez == 3) {rjesenje = sqrt(rjesenje)}else if (zarez == 4) {rjesenje = -rjesenje}else if (zarez == 5) {rjesenje = log(rjesenje)}else if (zarez == 6) {rjesenje = pow(E, rjesenje)}else if (zarez == 7) {rjesenje = 1/rjesenje}else if (zarez == 8) {rjesenje = log(rjesenje)/LN10}else if (zarez == 9) {rjesenje = pow(10, rjesenje)}else if (zarez >= 10 && zarez <= 12) {if (zarez == 10) {rjesenje = atan(rjesenje)}else if (zarez == 11) {rjesenje = acos(rjesenje)}else if (zarez == 12) {rjesenje = asin(rjesenje)}if (document.racunalo.stupnjevi[1].checked) {rjesenje = (rjesenje * 180) / PI}}else if (zarez >= 14 && zarez <= 16) {if (document.racunalo.stupnjevi[1].checked){radijani = (rjesenje / 180) * PI}else{radijani = rjesenje};if (zarez == 14) {rjesenje = tan(radijani)}else if (zarez == 15) {rjesenje = cos(radijani)}else if (zarez == 16) {rjesenje = sin(radijani)}}else if (zarez == 17) {rjesenje = rjesenje/100}else if (zarez == 18) {rjesenje = rjesenje/1000000}else if (zarez == 20) {rjesenje = factorial(rjesenje)}else if (zarez == 21) {eksponent = prompt("Unesite eksponent / Please enter exponent", 3);rjesenje = pow(rjesenje, eksponent)}else if (zarez == 22) {eksponent = prompt("Unesite korijen / Please enter root", 3);rjesenje = pow(rjesenje, (1/eksponent))}return rjesenje}}function zaokruzi(ebroj) {decimala=parseFloat(document.racunalo.izaZareza.options[document.racunalo.izaZareza.selectedIndex].value);var strbroj = ebroj + " ";if (strbroj.charAt(0) == ".") {strbroj = "0" + strbroj};var intbroj = strbroj.length - 1;deczarez(strbroj);if (intbroj > 16 && eksp == -1) {if (decimala == -1) {decimala = 14};strbroj = izazareza(strbroj.substring(0,intbroj)) + " ";intbroj = strbroj.length - 1;deczarez(strbroj)}if (decimala >= 0 && decimala != 14) {if (tocka > 0) {var odgovor = izazareza(strbroj.substring(0,intbroj))}else {ebroj = strbroj.substring(0,intbroj);if (decimala > 0) {ebroj += ".";for (var n = 0; n < decimala; n++) {ebroj += "0"}}var odgovor = ebroj}}else {decimala = 14;var odgovor = izazareza(strbroj)}if (odgovor.charAt(0) == ".") {odgovor = "0" + odgovor};document.racunalo.rezultat.value = odgovor;}function deczarez(novibroj) {tocka = 0;eksp = 0;tocka = novibroj.indexOf(".");eksp = novibroj.indexOf("e")}function izazareza(novibroj) {with (Math) {if (eksp == -1) {var duzina = tocka;if (duzina == -1) {duzina = novibroj.length};var desni = "";if (duzina > 16) {var privremeni = round(novibroj*pow(10, 18)) + " ";var novie = privremeni.indexOf("e");var lijevi = (privremeni.substring(0,novie));lijevi = round(lijevi*pow(10, 15))/pow(10, 15) + " ";desni = (privremeni.substring(novie+2,privremeni.length-1));desni = "e+" + (desni-18)}else {var lijevi = round(novibroj*pow(10, decimala))/pow(10, decimala) + " "}}else {var lijevi = novibroj.substring(0,eksp);var desni = novibroj.substring(eksp,novibroj.length);lijevi = round(lijevi*pow(10, decimala))/pow(10, decimala) + " "}lijevi = lijevi.substring(0,lijevi.length - 1);if (lijevi.charAt(0) == ".") {lijevi = "0" + lijevi};if (decimala < 14) {if (lijevi.indexOf(".") == -1 && decimala != 0) {lijevi += "."};var nula = (tocka + decimala) - (lijevi.length - 1);if (nula > 0 && decimala > 0) {for (var n = 0; n < nula; n++) {lijevi += "0"}}}return (lijevi + " " + desni)}}function factorial(n) {if ((n == 0) || (n == 1)) {return 1}else {var odgovor = (n * factorial(n-1));return odgovor}}function slovo(znak) {var slovo="(ABCDEFGHIKLMNOPRSTUVWXYZ";for (var i=0; i<slovo.length; i++)if (znak == slovo.charAt(i)) {return true} {return false}}function operator(znak) {var matoperator="*/+-";for (var i=0; i<matoperator.length; i++)if (znak == matoperator.charAt(i)) {return true}return false}function ubacirezultat(znak) {var ubacirezultat="*/+";for (var i=0; i<ubacirezultat.length; i++)if (znak == ubacirezultat.charAt(i)) {return true}return false}//Eni Generalic, Split, Create: 1999/10/14; Update: 2001/12/10--></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<body onload="document.racunalo.zadatak.focus()"><form name="racunalo"><input type="hidden" name="oldrezultat" value=""><input type="hidden" name="memorija" value=""><table border="4" cellspacing="0" cellpadding="1" align="center" bgcolor="#efefef" width="280"><tbody><tr> <td align="center" valign="middle"> <table border="2" width="100%" cellspacing="3" cellpadding="1" bgcolor="#cccccc"><tbody><tr> <td align="center" valign="middle" width="100%" bgcolor="#efefef"> <input type="text" size="13" name="rezultat" value="" onfocus="display(document.racunalo.rezultat.value)" style="background: rgb(239, 239, 239) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 14pt; height: 30px; width: 260px;"></td></tr></tbody></table><table border="2" cellspacing="3" cellpadding="0" bgcolor="#efefef"><tbody><tr> <td colspan="4" align="center" valign="middle"><nobr><font> <select name="izaZareza" size="1" onchange="if (document.racunalo.oldrezultat.value != '') {zaokruzi(document.racunalo.oldrezultat.value)}; document.racunalo.zadatak.focus()"><option value="-1" selected="selected">decimal</option><option value="0"> 0 </option><option value="1"> 1 </option><option value="2"> 2 </option><option value="3"> 3 </option><option value="4"> 4 </option><option value="5"> 5 </option><option value="6"> 6 </option><option value="7"> 7 </option><option value="8"> 8 </option><option value="9"> 9 </option><option value="10"> 10 </option><option value="11"> 11 </option><option value="12"> 12 </option><option value="13"> 13 </option><option value="14"> 14 </option><option value="15"> 15 </option></select></font><font size="2" face="Arial" color="#226622"><input type="radio" name="stupnjevi" checked="checked" title="Radians" onclick="document.racunalo.zadatak.focus()"><a href="javascript:document.racunalo.stupnjevi[0].click()" onmouseover="self.status='Radians'; return true">Rad</a><input type="radio" name="stupnjevi" title="Stupnjevi" onclick="document.racunalo.zadatak.focus()"><a href="javascript:document.racunalo.stupnjevi[1].click()" onmouseover="self.status='Degrees'; return true">Deg</a></font></nobr></td><td align="center"><a title=" Eni Generalic " href="http://www.ktf-split.hr/%7Eeni/" target="myHome"><font face="Times" size="2"><i><b>EniG.</b></i></font></a></td><td> <input height="24" width="38" type="button" name="Cls" value="Cls" title="Clear screen" onclick="memory(3)" style="background: rgb(238, 238, 238) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 10pt; height: 24px; width: 38px;"></td></tr><tr> <td colspan="6"></td></tr><tr bgcolor="#efefef"> <td align="center" valign="middle" width="100%" colspan="6"><font color="#0000ff" size="3"> <input type="text" size="17" name="zadatak" value="" onchange="enter.click()" onkeydown="if (event.keyCode==13) {enter.click()}" style="font-size: 10pt; font-weight: bold; height: 25px; width: 260px;"></font></td></tr><tr> <td> <input height="28" width="38" type="button" name="sqrt" value="sqrt" title="Square root" onclick="izracunaj(3)" class=func_button></td><td> <input height="28" width="38" type="button" name="root" value="root" title="Root" onclick="izracunaj(22)" class=func_button></td><td> <input height="28" width="38" type="button" name="ln" value="ln" title="Natural logarithm" onclick="izracunaj(5)" class=func_button></td><td> <input height="28" width="38" type="button" name="log" value="log" title="Common logarithm" onclick="izracunaj(8)" class=func_button></td><td> <input height="28" width="38" type="button" name="tan" value="tan" title="Tangent" onclick="izracunaj(14)" class=func_button></td><td> <input height="28" width="38" type="button" name="atan" value="atan" title="Arc tangent" onclick="izracunaj(10)" class=func_button></td></tr><tr> <td> <input height="28" width="38" type="button" name="kvadrat" value="x^2" title="Square" onclick="izracunaj(2)" class=func_button></td><td> <input height="28" width="38" type="button" name="potencija" value="x^y" title="Power" onclick="izracunaj(21)" class=func_button></td><td> <input height="28" width="38" type="button" name="aln" value="e^x" title="Natural antilogarithm" onclick="izracunaj(6)" class=func_button></td><td> <input height="28" width="38" type="button" name="alog" value="10^x" title="Common antilogarithm" onclick="izracunaj(9)" class=func_button></td><td> <input height="28" width="38" type="button" name="cos" value="cos" title="Cosine" onclick="izracunaj(15)" class=func_button></td><td> <input height="28" width="38" type="button" name="acos" value="acos" title="Arc cosine" onclick="izracunaj(11)" style="background: rgb(205, 205, 205) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 9pt; height: 28px; width: 38px;"></td></tr><tr> <td> <input height="28" width="38" type="button" name="sign" value="+/-" title="Change sign" onclick="izracunaj(4)" class=func_button></td><td> <input height="28" width="38" type="button" name="1/x" value="1/x" onclick="izracunaj(7)" class=func_button></td><td> <input height="28" width="38" type="button" name="fact" value="x!" title="Factorial" onclick="izracunaj(20)" class=func_button></td><td> <input height="28" width="38" type="button" name="PI" value="Pi" onclick="dodajBroj(Math.PI)" class=func_button></td><td> <input height="28" width="38" type="button" name="sin" value="sin" title="Sine" onclick="izracunaj(16)" class=func_button></td><td> <input height="28" width="38" type="button" name="asin" value="asin" title="Arc sine" onclick="izracunaj(12)" class=func_button></td></tr><tr> <td colspan="6"></td></tr><tr> <td> <input height="32" width="38" type="button" name="7" value="7" onclick="dodajBroj(7)" class=number_button></td><td> <input height="32" width="38" type="button" name="8" value="8" onclick="dodajBroj(8)" class=number_button></td><td> <input height="32" width="38" type="button" name="9" value="9" onclick="dodajBroj(9)" class=number_button></td><td> <input height="32" width="38" type="button" name="djeljeno" value="/" onclick="dodajBroj('/')" class=number_button></td><td> <input height="32" width="38" type="button" name="ppm" value="ppm" title="Part per milion" onclick="izracunaj(18)" style="background: rgb(205, 205, 205) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 10pt; height: 32px; width: 38px;"></td><td> <input height="32" width="38" type="button" name="MS" value="MS" title="Memory store" onclick="memory(1)" class=func_button2></td></tr><tr> <td> <input height="32" width="38" type="button" name="4" value="4" onclick="dodajBroj(4)" class=number_button></td><td> <input height="32" width="38" type="button" name="5" value="5" onclick="dodajBroj(5)" class=number_button></td><td> <input height="32" width="38" type="button" name="6" value="6" onclick="dodajBroj(6)" class=number_button></td><td> <input height="32" width="38" type="button" name="puta" value="*" onclick="dodajBroj('*')" class=number_button></td><td> <input height="32" width="38" type="button" name="postotak" value="%" title="Percent" onclick="izracunaj(17)" style="background: rgb(205, 205, 205) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 10pt; height: 32px; width: 38px;"></td><td> <input height="32" width="38" type="button" name="MR" value="MR" title="Memory recall" onclick="memory(2)" class=func_button2></td></tr><tr> <td> <input height="32" width="38" type="button" name="1" value="1" onclick="dodajBroj(1)" class=number_button></td><td> <input height="32" width="38" type="button" name="2" value="2" onclick="dodajBroj(2)" class=number_button></td><td> <input height="32" width="38" type="button" name="3" value="3" onclick="dodajBroj(3)" class=number_button></td><td> <input height="32" width="38" type="button" name="minus" value="-" onclick="dodajBroj('-')" class=number_button></td><td> <input height="32" width="38" type="button" name="lijevo" value="(" onclick="dodajBroj('(')" style="background: rgb(205, 205, 205) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 10pt; height: 32px; width: 38px;"></td><td> <input height="32" width="38" type="button" name="desno" value=")" onclick="dodajBroj(')')" style="background: rgb(205, 205, 205) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 10pt; height: 32px; width: 38px;"></td></tr><tr> <td> <input height="32" width="38" type="button" name="0" value="0" onclick="dodajBroj(0)" class=number_button></td><td> <input height="32" width="38" type="button" name="." value="." onclick="dodajBroj('.')" class=number_button></td><td> <input height="32" width="38" type="button" name="exp" value="E" onclick="dodajBroj('e')" style="background: rgb(222, 222, 222) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 10pt; height: 32px; width: 38px;"></td><td> <input height="32" width="38" type="button" name="plus" value="+" onclick="dodajBroj('+')" class=number_button></td><td colspan="2"> <input height="32" width="82" type="button" name="enter" onclick="izracunaj(1)" value="=" style="background: rgb(205, 205, 205) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-inline-policy: initial; -moz-background-origin: initial; font-size: 12pt; height: 32px; width: 83px;"></td></tr></tbody></table></td></tr></tbody></table></form></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->