[Code]Taschenrechner für Homepage!

  • Weis nicht obs Funkt ^^ einfach mal Testen und wens geht en Thanks oder Karma xD

    [FELD="Taschenrechner"]<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>
    [/FELD]


    Mfg
    Gotenks666

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!