htmlcodes
  Taschenrechner
 

Taschenrechner:

 

Quellcode:

<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 cellpadding="10" border="8">
        <tbody>
            <tr>
                <td bgcolor="#c0c0c0"><input maxlength="30" size="30" name="Display" /></td>
            </tr>
            <tr>
                <td>
                <table>
                    <tbody>
                        <tr>
                            <td width="50"><input onclick="Hinzufuegen('7')" type="button" value=" 7 " /></td>
                            <td width="50"><input onclick="Hinzufuegen('8')" type="button" value=" 8 " /></td>
                            <td width="70"><input onclick="Hinzufuegen('9')" type="button" value=" 9 " /></td>
                            <td width="50"><input onclick="Hinzufuegen('+')" type="button" value=" + " /></td>
                        </tr>
                        <tr>
                            <td width="50"><input onclick="Hinzufuegen('4')" type="button" value=" 4 " /></td>
                            <td width="50"><input onclick="Hinzufuegen('5')" type="button" value=" 5 " /></td>
                            <td width="70"><input onclick="Hinzufuegen('6')" type="button" value=" 6 " /></td>
                            <td width="50"><input onclick="Hinzufuegen('-')" type="button" value=" - " /></td>
                        </tr>
                        <tr>
                            <td width="50"><input onclick="Hinzufuegen('1')" type="button" value=" 1 " /></td>
                            <td width="50"><input onclick="Hinzufuegen('2')" type="button" value=" 2 " /></td>
                            <td width="70"><input onclick="Hinzufuegen('3')" type="button" value=" 3 " /></td>
                            <td width="50"><input onclick="Hinzufuegen('*')" type="button" value=" * " /></td>
                        </tr>
                        <tr>
                            <td width="50"><input onclick="Ergebnis()" type="button" value=" = " /></td>
                            <td width="50"><input onclick="Hinzufuegen('0')" type="button" value=" 0 " /></td>
                            <td width="70"><input onclick="Hinzufuegen('.')" type="button" value=" . " /></td>
                            <td width="50"><input onclick="Hinzufuegen('/')" type="button" value=" / " /></td>
                        </tr>
                        <tr>
                        </tr>
                        <tr>
                            <td width="50"><input onclick="Sonderfunktion('sqrt')" type="button" value="sqrt " /></td>
                            <td width="50"><input onclick="Sonderfunktion('pow')" type="button" value=" pow " /></td>
                            <td width="70"><input onclick="Sonderfunktion('log')" type="button" value=" log " /></td>
                            <td width="50"><input type="reset" value=" C " /></td>
                        </tr>
                    </tbody>
                </table>
                </td>
            </tr>
        </tbody>
    </table>
</form>

 
 
  Es waren schon 1864 Besucher (4934 Hits) hier!  
 
Diese Webseite wurde kostenlos mit Homepage-Baukasten.de erstellt. Willst du auch eine eigene Webseite?
Gratis anmelden