PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Taschenrechner für eure Page (z.B. eine Wechselstube)



Hardy
17.05.2007, 19:20
<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);
}
}
//-->
</script>


<form name="Rechner">
<table border=8 cellpadding=10>
<tr>
<td bgcolor=#C0C0C0><input name="Display" size=30 maxlength=30></td>
</tr>
<tr><td><table>
<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>
<tr>
<td width=50><input type=button value="sqrt " onClick="Sonderfunktion('sqrt')"></td>
<td width=50><input type=button value=" pow " 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>
</tr>
</table>
</td></tr></table>
</form>

Pitti
17.05.2007, 19:43
geiles Teil, gleich mal eingebaut:)

swinxx
18.05.2007, 02:56
Nettes Spielzeug, kommt auch bei mir rein wenn cih meine WS wieder starte !

thx, cu, Swinxx