Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][HTML] pole radio
limonides
post
Post #1





Grupa: Zarejestrowani
Postów: 46
Pomógł: 0
Dołączył: 30.05.2009

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


witam serdecznie

mam pytanie jak zrobić aby w zależności od tego jakie zaznaczone jest pole radio poniżej wyświetlały się różne pola text.

pozdrawiam i za wszelką pomoc z góry dziękuje
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
Mefiuu
post
Post #2





Grupa: Zarejestrowani
Postów: 371
Pomógł: 18
Dołączył: 23.11.2008

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


dynamicznie w javascript. A do łatwiejszego zaprogramowania polecam jquery (IMG:style_emoticons/default/wink.gif)
Go to the top of the page
+Quote Post
limonides
post
Post #3





Grupa: Zarejestrowani
Postów: 46
Pomógł: 0
Dołączył: 30.05.2009

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


  1. <legend>Wybierz typ konkursu jaki chcesz przeprowadzić</legend>
  2.  
  3. <input type="radio" name="odp" value="1" id="1" onclick="document.getElementById('luz').style.display = this.checked ? 'block' : 'none'; this.form.elements['luz'].disabled = !this.checked" /><label for="1">luźna odpowiedź</label>
  4. <input type="radio" name="odp" value="2" id="2" onclick="document.getElementById('wariant').style.display = this.checked ? 'block' : 'none'; this.form.elements['wariant'].disabled = !this.checked" /><label for="2">warianty odpowiedzi</label>
  5. <input type="radio" name="odp" value="3" id="3" onclick="document.getElementById('artysta').style.display = this.checked ? 'block' : 'none'; this.form.elements['artysta'].disabled = !this.checked" /><label for="3">artystyczny</label>
  6.  


  1. <legend>Wpisz pytanie konkursowe</legend>
  2. <div id="luz" style="display: none">
  3. lużna odp
  4. </div>
  5. <div id="wariant" style="display: none">
  6. warianty odp
  7. </div>
  8. <div id="artysta" style="display: none">
  9. artysta
  10. </div>


to jeszcze mam małe pytanie jeśli teraz wybiorę opcje nr.1 to pojawia mi się tekst "lużna odp", poźniej naciskam opcje nr. 2 i pojawia mi się tekst "warianty odp" ale wcześniejszy "luźna odp" nie znika. :/

próbowałem coś takiego
  1. IF ("document.forms.formularz1.odp[0].checked==true")
ale mi nie działa.
jakaś podpowiedź ?

Ten post edytował limonides 7.09.2011, 08:30:33
Go to the top of the page
+Quote Post
johny_s
post
Post #4





Grupa: Zarejestrowani
Postów: 594
Pomógł: 122
Dołączył: 17.07.2005
Skąd: P-na

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


trzeba ukryc pozostale odpowiedzi
  1. <legend>Wybierz typ konkursu jaki chcesz przeprowadzić</legend>
  2.  
  3. <input type="radio" name="odp" value="1" id="1" onclick="document.getElementById('luz').style.display='block'; document.getElementById('wariant').style.display='none'; document.getElementById('artysta').style.display='none'" /><label for="1">luźna odpowiedź</label>
  4. <input type="radio" name="odp" value="2" id="2" onclick="document.getElementById('luz').style.display='none'; document.getElementById('wariant').style.display='block'; document.getElementById('artysta').style.display='none'" /><label for="2">warianty odpowiedzi</label>
  5. <input type="radio" name="odp" value="3" id="3" onclick="document.getElementById('luz').style.display='none'; document.getElementById('wariant').style.display='none'; document.getElementById('artysta').style.display='block'" /><label for="3">artystyczny</label>
  6.  
  7.  
  8. <legend>Wpisz pytanie konkursowe</legend>
  9. <div id="luz" style="display: none">
  10. lużna odp
  11. </div>
  12. <div id="wariant" style="display: none">
  13. warianty odp
  14. </div>
  15. <div id="artysta" style="display: none">
  16. artysta
  17. </div>


btw. "=" to przypisanie nie porownanie (IMG:style_emoticons/default/wink.gif)
Go to the top of the page
+Quote Post
limonides
post
Post #5





Grupa: Zarejestrowani
Postów: 46
Pomógł: 0
Dołączył: 30.05.2009

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


wielkie dzięki.
temat zamknięty !
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.12.2025 - 17:08