WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   html-formular default button (http://www.wcm.at/forum/showthread.php?t=78360)

MrWolf 25.11.2002 23:17

html-formular default button
 
hallo!

ich habe in einem html-formular mehrere buttons. wenn ich in einem text feld eine eingabe mache und dann mit return das ganze formular abschicken will, wird aber immer der erste der form-buttons aktiviert. (der ist bei mir reset) ich möchte jedoch den submitbutton per default auswählen.

(ohne dass ich die reihenfolge vertauschen muss)

zed 26.11.2002 08:17

versuch mal dein problem damit zu lösen dass du dem "send" button die niedrigere "ID" gibst und dem reset button eine höhere

kannst du z.b. überprüfen indem du per tab taste drübergehst, die buttons bekommen nach reihenfolge der ID den fokus

_m3 26.11.2002 12:21

Mit einem HTML 4.01 konformen Browser geht das so:
http://www.w3.org/TR/html401/interac...html#h-17.11.1
Zitat:

17.11.1 Tabbing navigation

Attribute definitions

tabindex = number [CN]
This attribute specifies the position of the current element in the tabbing order for the current document. This value must be a number between 0 and 32767. User agents should ignore leading zeros.

The tabbing order defines the order in which elements will receive focus when navigated by the user via the keyboard. The tabbing order may include elements nested within other elements.
Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>A document with FORM</TITLE>
</HEAD>
<BODY>
...some text...


Go to the
W3C Web site.
...some more...
<BUTTON type="button" name="get-database"
          tabindex="1" onclick="get-database">
Get the current database.
</BUTTON>
...some more...
<FORM action="..." method="post">



<INPUT tabindex="1" type="text" name="field1">
<INPUT tabindex="2" type="text" name="field2">
<INPUT tabindex="3" type="submit" name="submit">
</P>
</FORM>
</BODY>
</HTML>



Alle Zeitangaben in WEZ +2. Es ist jetzt 13:05 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag