Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [js] tworzenie funkcji
rychu123
post
Post #1





Grupa: Zarejestrowani
Postów: 194
Pomógł: 1
Dołączył: 18.09.2008

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


Witam, nie znam js dlatego pytam jak zrobić funkcje z tego

onFocus="this.style.background= '#808000'"

onBlur="this.style.background= '#fff'"

i chciałbym żeby w parametrze funkcji można dodawać kolor proszę o pomoc
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
darko
post
Post #2





Grupa: Zarejestrowani
Postów: 2 885
Pomógł: 463
Dołączył: 3.10.2009
Skąd: Wrocław

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


np.
  1. <body onload="changeColor(document.getElementById('ile'),'#FF0000','#00FF00');">
  2. <!--
  3. -->
  4. <input type="text" id="ile" />
  5. <!--
  6. -->
  7. function changeColor(obj, cfocus, cblur) {
  8. obj.onfocus = function() {obj.style.background = cfocus;}
  9. obj.onblur = function() {obj.style.background = cblur;}
  10. }
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: 7.10.2025 - 19:31