Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: radio i wylaczanie innych elementow form
Forum PHP.pl > Forum > Po stronie przeglądarki > JavaScript
warkakw
witam

mam formularz na ktorym sa kolejno:

- pole typu radio
- pole typu file
- pole typu radio
- pole typu textbox

potrzebny mi skrypt ktory po wybraniu pierwszego radio zrobi file na odblokowany
a textbox na zablokowany(disabled) a po wybraniu drugiego radio odwrotnie.

probowalem z tym walczyc ale mi nie wychodzi.

thx za pomoc
gekon
Z File nic nie zrobisz.
warkakw
zrobie zrobie, juz zrobilem smile.gif

  1. function F_opcja(lp)
  2. {
  3. if (lp==1)
  4. {
  5. document.getElementById("skrypt").setAttribute("disabled","disabled");
  6. document.getElementById("www").setAttribute("disabled","disabled");
  7. document.getElementById("file").removeAttribute("disabled");
  8. }
  9.  
  10. if (lp==2)
  11. {
  12. document.getElementById("file").setAttribute("disabled","disabled");
  13. document.getElementById("skrypt").setAttribute("disabled","disabled");
  14. document.getElementById("www").removeAttribute("disabled");
  15. }
  16.  
  17. if (lp==3)
  18. {
  19. document.getElementById("file").setAttribute("disabled","disabled");
  20. document.getElementById("www").setAttribute("disabled","disabled");
  21. document.getElementById("skrypt").removeAttribute("disabled");
  22. }
  23. }


wywolanie:
<input name="radio" type="radio" value="1" onclick="F_opcja(1);">

pozdrawiam
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.