Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Formularz button up/down
kilofmar
post
Post #1





Grupa: Zarejestrowani
Postów: 70
Pomógł: 0
Dołączył: 29.11.2006

Ostrzeżenie: (0%)
-----


Witam.
Mam formularz w którym mogę poruszac się po polach za pomoca przycisku TABULATORA
np.
<input tabindex="100" name="xx" >
<input tabindex="200" name="xx" >
<input tabindex="300" name="xx" >
<input tabindex="400" name="xx" >

Jak zrobić aby można było poruszać się za pomocą przysików "Strzałki" UP/DOWN, LEFT/RIGHT?

Witam.
Znalazłem rozwiązanie więc dziele się z nim.
  1. $(document).ready(function(){
  2. $('input').keyup(function(e){
  3. if(e.which==39)
  4. $(this).closest('td').next().find('input').focus();
  5. else if(e.which==37)
  6. $(this).closest('td').prev().find('input').focus();
  7. else if(e.which==40)
  8. $(this).closest('tr').next().find('td:eq('+$(this).closest('td').index()+')').find('input').focus();
  9. else if(e.which==38)
  10. $(this).closest('tr').prev().find('td:eq('+$(this).closest('td').index()+')').find('input').focus();
  11. });
  12. });
Go to the top of the page
+Quote Post

Posty w temacie
- kilofmar   Formularz button up/down   11.04.2014, 10:56:03


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 16:22