Computerhilfen.de Logo
Forum
Tipps
News
Frage stellen

HTML und Javascript - Plus und Minus ???

Hi,
Kann mir vieleicht jemand helfen un zwar möchte ich eine seite machen wo ein textfeld und zwei buttons sind ein minus und ein plus button.

Bis jetzt siehts so aus:

Zitat
<script language="JavaScript">
<!--
function RechnenPlus(n){
document.F1.n.value+="1";
}
function RechnenMinus(m){
document.F1.m.value-="1";
}
//-->
</script>
<form action="" name="F1">
<INPUT TYPE="TEXT" Name="T1" Maxlength="3" DISABLED="TRUE" VALUE="0" SIZE="1" align="Bottom">

<input type="Button" name="B1" value="+" OnClick="RechnenPlus(B1)"><input type="Button" name="B2" value="-" OnClick="RechnenMinus(B2)">
</form>
Ich möchte das wenn ich auf einen derbuttons klicke im textfeld entweder minus 1 oder plus 1 gerechnet wird.

Mfg


« Letzte Änderung: 11.03.05, 13:12:28 von BigBobbie »

Antworten zu HTML und Javascript - Plus und Minus ???:

Und kann mir irgendjemand helfen Please ???

Hi,
was hast du überhaupt vor?
willst ein Rechner auf eine Seite machen? Dann muss der Quelltext Code so aussehen! Vieleicht hilft dir der Code auch so weiter ;)

Zitat
[quote author=BigBobbie <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>


Gruß Jonny
« Letzte Änderung: 12.03.05, 12:27:20 von Jonny83 »

Damke für deine Antwrot aber hat sich schon erledigt, Thx.
Mfg


« eigene flash buttonsForum anzeigen »
 

Schnelle Hilfe: Hier nach ähnlichen Fragen und passenden Tipps suchen!

Fremdwörter? Erklärungen im Lexikon!
Undo
"Undo" steht für "Rückgängig machen": eine häufig genutzte Funktion n vielen Programmen und Apps, die es ermöglicht, kürzlich durchgefü...

Multiprozessor Rechner
Multiprozessorsysteme oder Multiprozessor-Rechner sind Computer, die mehr als einen Hauptprozessor (CPU) zur Ausführung von Aufgaben verwenden. Sie ermöglichen ...

Quellcode
Ein Quellcode, auch als Quelltext bekannt, bezeichnet den unkompilierten Programm-Code einer Software. Quell- oder Programm-Code ist der auch für Menschen lesbare Co...