|
|
ilch Text Manager
| Menü: zurück zum Hauptmenü / Codeschnipsel eintragen / zurück
|
Taschenrechner  |
| Code | 0: 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104:
|
<script language="JavaScript">
<!--
function Ergebnis()
{
var x = 0;
x = eval(window.document.Rechner.Display.value);
window.document.Rechner.Display.value = x;
}
function Hinzufuegen(Zeichen)
{
window.document.Rechner.Display.value =
window.document.Rechner.Display.value + Zeichen;
}
function Sonderfunktion(Funktion)
{
if(Funktion == "sqrt")
{
var x = 0;
x = eval(window.document.Rechner.Display.value);
window.document.Rechner.Display.value = Math.sqrt(x);
}
if(Funktion == "pow")
{
var x = 0;
x = eval(window.document.Rechner.Display.value);
window.document.Rechner.Display.value = x * x;
}
if(Funktion == "log")
{
var x = 0;
x = eval(window.document.Rechner.Display.value);
window.document.Rechner.Display.value = Math.log(x);
}
}
file://-->
</script>
<center>
<h1>Rechner</h1>
<form name="Rechner">
<div align="center"><table border="10" cellpadding="10" bgcolor="#C0C0C0">
<tr>
<td bgcolor="#8C8C8C"><input type="text" size="30"
maxlength="30" name="Display"></td>
</tr>
<tr>
<td><table border="0">
<tr>
<td width="50"><input type="button"
value=" 7 " onclick="Hinzufuegen('7')"></td>
<td width="50"><input type="button"
value=" 8 " onclick="Hinzufuegen('8')"></td>
<td width="70"><input type="button"
value=" 9 " onclick="Hinzufuegen('9')"></td>
<td width="50"><input type="button"
value=" + " onclick="Hinzufuegen('+')"></td>
</tr>
<tr>
<td width="50"><input type="button"
value=" 4 " onclick="Hinzufuegen('4')"></td>
<td width="50"><input type="button"
value=" 5 " onclick="Hinzufuegen('5')"></td>
<td width="70"><input type="button"
value=" 6 " onclick="Hinzufuegen('6')"></td>
<td width="50"><input type="button"
value=" - " onclick="Hinzufuegen('-')"></td>
</tr>
<tr>
<td width="50"><input type="button"
value=" 1 " onclick="Hinzufuegen('1')"></td>
<td width="50"><input type="button"
value=" 2 " onclick="Hinzufuegen('2')"></td>
<td width="70"><input type="button"
value=" 3 " onclick="Hinzufuegen('3')"></td>
<td width="50"><input type="button"
value=" * " onclick="Hinzufuegen('*')"></td>
</tr>
<tr>
<td width="50"><input type="button"
value=" = " onclick="Ergebnis()"></td>
<td width="50"><input type="button"
value=" 0 " onclick="Hinzufuegen('0')"></td>
<td width="70"><input type="button"
value=" . " onclick="Hinzufuegen('.')"></td>
<td width="50"><input type="button"
value=" / " onclick="Hinzufuegen('/')"></td>
</tr>
<tr>
<td width="50"><input type="button"
value=" sqr "
onclick="Sonderfunktion('sqrt')"></td>
<td width="50"><input type="button"
value=" ² "
onclick="Sonderfunktion('pow')"></td>
<td width="70"><input type="button"
value=" log "
onclick="Sonderfunktion('log')"></td>
<td width="50"><input type="reset"
value=" C "></td>
</tr>
</table>
</td>
</tr>
</table>
</center></div>
</form>
|
|
Geschrieben von Freshmaker_01
zurück
|
|
|
| |