Gast: Auslösen Button bei "Enter"

Hallo,

ich habe hier ein kleines Problem welches ich mir nicht erkären kann.
Ich habe eine Tabelle mit 2 Input-Feldern und einem Submit-Button. Das ganze geklammert von einer Form.

Hier mal der Bsp-Code:

  
<html>  
<head>  
</head>  
<body onload="document.forms[0].login.focus();">  
  
<form method="POST" name="loginform" action="/wasAuchImmer" target="_self">  
<table border="0" cellspacing="0" cellpadding="2">  
<tr>  
        <td>User</td>  
        <td>&nbsp;</td>  
        <td><input type="text" name="login" value="" size="20" maxlength="15" style="width:150px;" /></td>  
</tr>  
<tr>  
        <td>Passwort</td>  
        <td>&nbsp;</td>  
        <td><input type="password" name="pin" value="" maxlength="5" size="20" style="width:150px;" /></td>  
</tr>  
<tr>  
        <td colspan="2">&nbsp;</td>  
        <td align="right"><input type="button" value="OK" onclick="javascript:document.forms[0].submit()"/></td>  
</tr>  
</table>  
</form>  
  
</body>  
</html>  

Ich habs auch noch mal hochgeladen um es "live" zu erleben: Link

Was mich wundert: Wenn ich in einem der beiden Inputfelder die Enter-Taste drücke wird der Submit-Button nicht(!) ausgelöst. Habe ich nur 1 Inputfield funktioniert das aber.

Ist das normal?!? Vielleicht kann mir hier jemand weiterhelfen...

Danke im Voraus!

  1. Hallo,

    <input type="button" value="OK" onclick="javascript:document.forms[0].submit()"/></td>

    wieso nimmst du keinen Submit-Button?
    <input type="submit" value="OK">

    MfG. Christoph Ludwig

    --
    Wo die Sprache aufhört, fängt die Musik an...
    Selfcode:  sh:) fo:) ch:° rl:( br:^ n4:} ie:{ mo:} va:) js:| de:] zu:) fl:( ss:| ls:~
    Go to this
    1. Wow, das war mal ne schnelle Antwort!
      Und danke für den Hinweis. "Natürlich" wäre es so richtiger und "natürlich" löst das auch mein Problem. Weiß auch nicht warum mir das nicht aufgefallen ist....

      Danke nochmal!

      Hallo,

      »» <input type="button" value="OK" onclick="javascript:document.forms[0].submit()"/></td>

      wieso nimmst du keinen Submit-Button?
      <input type="submit" value="OK">

      MfG. Christoph Ludwig