- // PAGE 1 !
-
- <html>
- <head>
- <title>Calculatrice Simple</title>
-
- <script language="JavaScript">
-
- function verification(entree) {
- var car ="1234567890[]()+-.*,/";
- for (var i = 0; i < entree.length; i++)
- if (car.indexOf(entree.charAt(i))<0 ) return false;
- return true;
- }
-
- function calcul() {
- var a = 0;
- if (verification(window.document.calculatrice.result.value))
- a = eval(window.document.calculatrice.result.value);
- window.document.calculatrice.result.value = a;
- }
-
- function ajouter(caracteres) {
- window.document.calculatrice.result.value =
- window.document.calculatrice.result.value + caracteres;
- }
-
- function fonction_speciale(fonction) {
- if (verification(window.document.calculatrice.result.value)) {
- if(fonction == "sqrt") {
- var a = 0;
- a = eval(window.document.calculatrice.result.value);
- window.document.calculatrice.result.value = Math.sqrt(a);
- }
- if(fonction == "pow") {
- var a = 0;
- a = eval(window.document.calculatrice.result.value);
- window.document.calculatrice.result.value = a * a;
- }
- if(fonction == "log") {
- var a = 0;
- a = eval(window.document.calculatrice.result.value);
- window.document.calculatrice.result.value = Math.log(a);
- }
- } else window.document.calculatrice.result.value = 0
- }
-
- </script>
- </head>
- <body>
- <table border bgcolor=#0001cc>
- <th>
- <form name="calculatrice">
- <center>
- <textarea style="WIDTH: 186px; HEIGHT: 24px; TEXT-ALIGN:right;" name="result" align="right" class="affiche"></textarea><br>
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b2" value="7" onClick="ajouter('7')" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b3" value="8" onClick="ajouter('8')" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b4" value="9" onClick="ajouter('9')" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b12" value=":" onClick="ajouter('/')" size="30"><br>
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b5" value="4" onClick="ajouter('4')" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b6" value="5" onClick="ajouter('5')" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b7" value="6" onClick="ajouter('6')" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b11" value="x" onClick="ajouter('*')" size="30"><br>
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b8" value="1" onClick="ajouter('1')" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b9" value="2" onClick="ajouter('2')" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b10" value="3" onClick="ajouter('3')" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b13" value="-" onClick="ajouter('-')" size="30"><br>
- <input style="FONT-WEIGHT: bold; WIDTH: 92px; HEIGHT: 24px" type="button" name="b14" value="0" onClick="ajouter('0')" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b15" value="." onClick="ajouter('.')" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b16" value="+" onClick="ajouter('+')" size="30"><br>
- <input style="FONT-WEIGHT: bold; WIDTH: 140px; HEIGHT: 24px" type="reset" name="b17" value="ON/C" size="30">
- <input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b18" value="=" onClick="calcul()" size="30"><br>
- <input style="FONT-WEIGHT: bold; WIDTH: 60px; HEIGHT: 24px" type="button" class="button" value="sqrt " onClick="fonction_speciale('sqrt')">
- <input style="FONT-WEIGHT: bold; WIDTH: 60px; HEIGHT: 24px" type="button" class="button" value=" pow " onClick="fonction_speciale('pow')">
- <input style="FONT-WEIGHT: bold; WIDTH: 60px; HEIGHT: 24px" type="button" class="button" value=" log " onClick="fonction_speciale('log')">
- </center>
- </form>
- </th>
- </table>
-
-
- </body>
- </html>
-
-
- // PAGE 2 !
-
- <html>
-
- <head>
- <title>Calculatrice Simple</title>
- </head>
-
- <body vlink="#0000FF">
-
- <p><a href="calcul.htm" target="popup"
- onmouseover="this.style.color='red'"
- onmouseout="this.style.color='blue'"
- onclick="window.open('','popup','width=218,height=215,left=100,top=100,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,status=no')">Calculatrice</a>
- </p>
- </body>
- </html>
// PAGE 1 !
<html>
<head>
<title>Calculatrice Simple</title>
<script language="JavaScript">
function verification(entree) {
var car ="1234567890[]()+-.*,/";
for (var i = 0; i < entree.length; i++)
if (car.indexOf(entree.charAt(i))<0 ) return false;
return true;
}
function calcul() {
var a = 0;
if (verification(window.document.calculatrice.result.value))
a = eval(window.document.calculatrice.result.value);
window.document.calculatrice.result.value = a;
}
function ajouter(caracteres) {
window.document.calculatrice.result.value =
window.document.calculatrice.result.value + caracteres;
}
function fonction_speciale(fonction) {
if (verification(window.document.calculatrice.result.value)) {
if(fonction == "sqrt") {
var a = 0;
a = eval(window.document.calculatrice.result.value);
window.document.calculatrice.result.value = Math.sqrt(a);
}
if(fonction == "pow") {
var a = 0;
a = eval(window.document.calculatrice.result.value);
window.document.calculatrice.result.value = a * a;
}
if(fonction == "log") {
var a = 0;
a = eval(window.document.calculatrice.result.value);
window.document.calculatrice.result.value = Math.log(a);
}
} else window.document.calculatrice.result.value = 0
}
</script>
</head>
<body>
<table border bgcolor=#0001cc>
<th>
<form name="calculatrice">
<center>
<textarea style="WIDTH: 186px; HEIGHT: 24px; TEXT-ALIGN:right;" name="result" align="right" class="affiche"></textarea><br>
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b2" value="7" onClick="ajouter('7')" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b3" value="8" onClick="ajouter('8')" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b4" value="9" onClick="ajouter('9')" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b12" value=":" onClick="ajouter('/')" size="30"><br>
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b5" value="4" onClick="ajouter('4')" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b6" value="5" onClick="ajouter('5')" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b7" value="6" onClick="ajouter('6')" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b11" value="x" onClick="ajouter('*')" size="30"><br>
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b8" value="1" onClick="ajouter('1')" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b9" value="2" onClick="ajouter('2')" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b10" value="3" onClick="ajouter('3')" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b13" value="-" onClick="ajouter('-')" size="30"><br>
<input style="FONT-WEIGHT: bold; WIDTH: 92px; HEIGHT: 24px" type="button" name="b14" value="0" onClick="ajouter('0')" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b15" value="." onClick="ajouter('.')" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b16" value="+" onClick="ajouter('+')" size="30"><br>
<input style="FONT-WEIGHT: bold; WIDTH: 140px; HEIGHT: 24px" type="reset" name="b17" value="ON/C" size="30">
<input style="FONT-WEIGHT: bold; WIDTH: 44px; HEIGHT: 24px" type="button" name="b18" value="=" onClick="calcul()" size="30"><br>
<input style="FONT-WEIGHT: bold; WIDTH: 60px; HEIGHT: 24px" type="button" class="button" value="sqrt " onClick="fonction_speciale('sqrt')">
<input style="FONT-WEIGHT: bold; WIDTH: 60px; HEIGHT: 24px" type="button" class="button" value=" pow " onClick="fonction_speciale('pow')">
<input style="FONT-WEIGHT: bold; WIDTH: 60px; HEIGHT: 24px" type="button" class="button" value=" log " onClick="fonction_speciale('log')">
</center>
</form>
</th>
</table>
</body>
</html>
// PAGE 2 !
<html>
<head>
<title>Calculatrice Simple</title>
</head>
<body vlink="#0000FF">
<p><a href="calcul.htm" target="popup"
onmouseover="this.style.color='red'"
onmouseout="this.style.color='blue'"
onclick="window.open('','popup','width=218,height=215,left=100,top=100,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,status=no')">Calculatrice</a>
</p>
</body>
</html>