Einzelnen Beitrag anzeigen

Benutzerbild von c113plpbr
c113plpbr

Registriert seit: 18. Nov 2003
Ort: localhost
674 Beiträge
 
Delphi 2005 Professional
 
#5

Re: [html/javascript] Formular: Tab 'ausführen'

  Alt 28. Jun 2004, 19:52
arrgh! daher mag ich kein c/c++ ... und auch kein java ... ^^ jetzt funktionierts:
Code:
<html>
<head>
<script language="javascript">
<!--
function focusnext(comp)
{
   var i = 0;
   if(comp.value.length == comp.maxLength)
   {
      while (i < 100)
      {
         if(comp.form.elements[i])
         {
            if(comp.form.elements[i].tabIndex == comp.tabIndex + 1)
            {
               comp.form.elements[i].focus();
               break;
            }
         }
         else
         {
            break;
         }
         i++;
      }
   }
}
//-->
</script>
</head>
<body>
  <form name="form1" method="post" action="">
    <input type="text" name="textfield1" onkeypress="focusnext(this);" maxlength="2" tabindex="1">
    <input type="text" name="textfield2" onkeypress="focusnext(this);" maxlength="3" tabindex="3">
    <input type="text" name="textfield3" onkeypress="focusnext(this);" maxlength="1" tabindex="2">
    <input type="text" name="textfield4" onkeypress="focusnext(this);" maxlength="5" tabindex="5">
    <input type="text" name="textfield5" onkeypress="focusnext(this);" maxlength="4" tabindex="4">
   


    <input type="button" name="Submit" value="Submit">
  </form>
</body>
</html>
@himitsu: "comp.form.elements[i]..."
das stimmt so, da 'form' die übergeordnete form der komponente übergibt, in der ich dann die elemente duchsuchen kann ...

danke, Philipp
Philipp
There is never enough time to do all the nothing you want.
*HABENWILL*
  Mit Zitat antworten Zitat