Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> onkeyup reakcje na przycisk
pacior
post
Post #1





Grupa: Zarejestrowani
Postów: 101
Pomógł: 2
Dołączył: 25.09.2007

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


  1. function funkcja(){
  2. if(czy klikniętą strzałkę w gorę)
  3. alert('tekst');
  4. }
  5. </script>
  6. <input type="text" id="nazwa" name="nazwa" onkeyup="funkcja()" />


Potrzebuje napisać if'y które powiedzą mi że kliknąłem dany znak np strzałkę, literę cyfrę

Ten post edytował pacior 8.04.2008, 14:59:07
Go to the top of the page
+Quote Post
skowron-line
post
Post #2





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


  1. document.onkeydown = checkKeycode
  2. function checkKeycode(e) {
  3. var keycode;
  4. if (window.event) keycode = window.event.keyCode;
  5. else if (e) keycode = e.which;
  6. alert("keycode: " + keycode);
  7. }

google.pl\
http://www.cambiaresearch.com/c4/702b8cd1-...-Key-Codes.aspx
i lista

Ten post edytował skowron-line 8.04.2008, 14:48:18
Go to the top of the page
+Quote Post
webdice
post
Post #3


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




  1.  
  2. function showKey (event)
  3. {
  4. var key = event.keyCode ? event.keyCode : event.charCode;
  5.  
  6. alert ('Key: ' + key);
  7. }
  8.  
  9. document.onkeypress = showKey;
  10.  


Resztę sobie sam dopiszesz.
Go to the top of the page
+Quote Post
pacior
post
Post #4





Grupa: Zarejestrowani
Postów: 101
Pomógł: 2
Dołączył: 25.09.2007

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


showKey (?), checkKeycode(?) co ma się tu znaleść
Go to the top of the page
+Quote Post
webdice
post
Post #5


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




Nic, tak ma być (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) . Wywołujesz funkcje bez argumentów.
Go to the top of the page
+Quote Post
pacior
post
Post #6





Grupa: Zarejestrowani
Postów: 101
Pomógł: 2
Dołączył: 25.09.2007

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


  1. function searchUser(event){
  2. var key = event.keyCode ? event.keyCode : event.charCode;
  3. alert ('Key: ' + key);
  4. }
  5.  
  6. <input onkeyup="searchUser()" type="text" name="testField" id="testField" autocomplete="off"/>


Jest błąd FirBug zwraca "event has no properties"

Pewnie tutaj jest błąd <input onkeyup="searchUser()" (...)

juz wiem

  1. function funkcja(e){
  2. alert(e.keyCode);
  3. }
  4. <input type="text" id="nazwa" name="nazwa" onkeyup="funkcja(event)" />
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: 22.08.2025 - 21:59