Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Input type + onfocus
ActivePlayer
post
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
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
Go to the top of the page
+Quote Post
ActivePlayer
post
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
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.08.2025 - 21:59