onKeypress im Firefox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • onKeypress im Firefox

    hallo zusammen,

    ich habe ein kleines Problem mit onKeypress im Firefox. Folgendes Formular habe ich in meinem Skript. Wenn man auf die Enter Taste klickt soll das Formular abgeschickt werden. Das funktioniert im IE auch einwandfrei, nur der Firefox macht stress. Wenn ich eines, der beiden Textfelder lösche, funktioniert es wunderbar?!


    PHP Code:
    <table border="0" class="table_menue_login" cellspacing="0" cellpadding="0">
           <form name="form_login" method="post" action="' . $referer . '">
            
            <tr>
             <td><img src="images/menue/login.gif" style="margin-bottom: 2px;"></td>
            </tr>
            
            <tr>
             <td><input type="text" name="text_loginname" class="textfelder_login_login" value="NAME"'; ?> 
    onFocus="if (value == 'NAME') {value =''}" onBlur="if (value == '') {value = 'NAME'}" <? echo '></td>
            </tr>
          
            <tr>
             <td><input type="password" name="text_loginpw" class="textfelder_login_login" value="PASSWORT"'; ?> 
    onFocus="if (value == 'PASSWORT') {value =''}" onBlur="if (value == '') {value = 'PASSWORT'}" 
    <? echo ' onKeypress="if(window.event.keyCode==13) document.form_login.submit();">
                 <input type="hidden" name="senden_login" value="Senden"></td>
            </tr>
           
           </table>
           
           <table border="0" class="table_menue_login_button" cellspacing="0" cellpadding="0">
            
            <tr>
             <td><img src="images/menue/login.gif" title="Login" class="pointer" onClick="submit();"></td>
            </tr>

           </form>
           </table>

  • #2
    .keyCode ist nur in IE gültig, andere Browser muss du über .which abfragen. Mehr dazu http://de.selfhtml.org/index.htm

    Comment


    • #3
      ahh ok das erklärt einiges.

      ich habe mir das mit which auch schon angesehen, nur habe ich hier das Problem, das ich nicht ganz verstehe, wie ich das Textfeld abfragen soll.

      kannst du mir da einen tipp geben?

      ich habe es bisher so audprobiert

      PHP Code:
      function Position () {
        alert(document.form_login.text_loginpw.which);
        }

      <tr>
               <td><input type="password" name="text_loginpw" class="textfelder_login_login" value="PASSWORT"' ?> 
      onFocus="if (value == 'PASSWORT') {value =''}" onBlur="if (value == '') {value = 'PASSWORT'}" 
      <? echo ' onkeypress="Position();">
                   <input type="hidden" name="senden_login" value="Senden"></td>
              </tr>
      so bekomme ich aber immer undefined angezeigt
      Last edited by SOB22; 17-04-2006, 13:33.

      Comment


      • #4
        ahh ich habs, war doch recht easy

        PHP Code:
        function Position (Ereignis
          {
           var 
        wert Ereignis.which;
           if (
        wert == 13)
            
        document.form_login.submit();
          } 
        danke für den tipp mit wich.

        Comment

        Working...
        X