Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Input type + onfocus
ActivePlayer
post 24.03.2005, 15:35:34
Post #1





Grupa: Przyjaciele php.pl
Postów: 1 224
Pomógł: 40
Dołączył: 6.07.2004
Skąd: Wuppertal

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


  1. <input type="text" name="stop_rr" size='1' maxlength='4' onfocus="document.forms['formularz'].stop_rr.value='20';" value="20rr">


i teraz... wszystko ładnie pieknie.. tylko ze jak klikne w input, to kursor jest na początku, czyli przed '20', a chcialbym zeby bylo po
Go to the top of the page
+Quote Post
nospor
post 24.03.2005, 15:50:16
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Spróbuj tego. Znalazlem gdzieś na innym forum. Nie sprawdzalem. daj znac czy dziala:
  1. <input type="text" name="stop_rr" size='1' maxlength='4' onfocus="this.value='20';var r = this.createTextRange();r.moveStart('character', r.text.length); r.select();" value="20rr">


ps.: wystarczy dac this.value

edit: znalazlem cos innnego. testowalem dziala (pod ie):
  1. <script language="javascript" type="text/javascript">
  2.  
  3. function setfocus(fld){
  4. if (fld.createTextRange){
  5. var fieldrange = fld.createTextRange();
  6. fieldrange.moveStart('character', fld.value.length);
  7. fieldrange.collapse();
  8. fieldrange.select();
  9. }
  10.  
  11.  
  12. }
  13.  
  14.  
  15.  
  16.  
  17.  
  18. <input type="text" name="stop_rr" size='20' maxlength='4' onfocus="this.value='20';setfocus(this);" value="20rr">


Ten post edytował nospor 24.03.2005, 15:59:43


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
ActivePlayer
post 24.03.2005, 16:09:38
Post #3





Grupa: Przyjaciele php.pl
Postów: 1 224
Pomógł: 40
Dołączył: 6.07.2004
Skąd: Wuppertal

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


no ja kalecze js. dzieki. dziala !
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 14.07.2025 - 17:44