Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [html] automatyczne przechodzenie pomiedzy komponentami input
drobny
post
Post #1





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 4.08.2006

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


Mam kilka komponentow input

  1. Godzina: <input type="text" name="godz" maxlength=2>:<input type="text" name="min" maxlength=2>


Chodzi mi o to ze chcialbym zeby po wpisaniu dwoch znakow godziny kursor automatycznie przeszedl do kolejnego komponentu

Nie bardzo mam pomysł jak to zrobic wiec prosze o pomoc

Z góry dzieki (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Cysiaczek
post
Post #2





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Ok. Nie podoba mi się ten skrypt, ale działa (IMG:http://forum.php.pl/style_emoticons/default/laugh.gif) . Zarówno pod Operą jak i FF

  1. function changeFocus(curr, nexty) {
  2.  
  3. var inputs=new Array();
  4. inputs[1]='min';
  5. inputs[2]='sec';
  6.  
  7. maxlen=document.forms[0][curr].getAttribute('maxlength');
  8. actual=document.forms[0][curr].value.length;
  9.  
  10. if (actual==maxlen){
  11. document.forms[0][inputs[nexty]].focus();
  12. }
  13. else {return;}
  14. }
  15.  
  16. <input type="text" name="godz" maxlength="2" size="2" onKeyUp='changeFocus(this.name, 1)'>
  17. <input type="text" name="min" maxlength="2" size="2" onKeyUp='changeFocus(this.name, 2)'>
  18. <input type="text" name="sec">
Go to the top of the page
+Quote Post

Posty w temacie


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: 26.12.2025 - 16:51