Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP]Jak zrobić pole text zależne od radio
Vion
post
Post #1





Grupa: Zarejestrowani
Postów: 112
Pomógł: 2
Dołączył: 27.06.2008

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


Witam
Chcę zrobić element radio w formularzu i jeżeli zostanie wybrana pierwsza opcja to następnym polem w tym formularzu będzie pole typu text, jeśli wybiorę drugą opcję to wyświetli pole typu password. Jak to zrobić ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Vion
post
Post #2





Grupa: Zarejestrowani
Postów: 112
Pomógł: 2
Dołączył: 27.06.2008

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


zrobiłem, coś takiego
  1. Opcja 1:<input type="radio" id="dataType" name="dataType"
  2. onchange="if (this.checked==true) document.getElementById('id1').style.display = 'block'">
  3. Opcja 2 <input type="radio" id="dataType" name="dataType"
  4. onchange="if (this.checked==true) document.getElementById('id2').style.display = 'block'">
  5.  
  6.  
  7. <input type="text" name="nr_konta" id="id1" style="display: none"/>
  8. <input type="text" name="nr_konta" id="id2" style="display: none"/>


ale gdy odznaczę dane radio, to pole text jest dalej widoczne
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: 27.09.2025 - 05:09