Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Drobny problem :)
Forum PHP.pl > Forum > Po stronie przeglądarki
djbarca
  1. <script type="text/javascript" language="javascript">
  2. function hide_them_all() {
  3.  
  4. document.getElementById("opcja1_options").style.display = "none";
  5. document.getElementById("opcja2_options").style.display = "none";
  6.  
  7. }
  8.  
  9. <input type="radio" checked name="what" value="opcja1" id="radio_plugin_opcja1" onclick="if(this.checked) {
  10. hide_them_all(); document.getElementById('opcja1_options').style.display = 'block'; }; return true"/>
  11. <label for="radio_plugin_opcja1">Opcja 1</label>
  12.  
  13. <input type="radio" name="what" value="opcja2" id="radio_plugin_opcja2" onclick="if(this.checked) {
  14. hide_them_all(); document.getElementById('opcja2_options').style.display = 'block'; }; return true"/>
  15. <label for="radio_plugin_opcja2">Opcja 2</label>
  16.  
  17. <fieldset id="opcja1_options" class="options"><legend>Widoczne opcje jeden :)</legend>tutaj wszystko co
  18.  
  19. do opcji 1</fieldset>
  20.  
  21. <fieldset id="opcja2_options" class="options"><legend>Widoczne opcje dwa :)</legend>tutaj wszystko co do
  22.  
  23. opcji 2</fieldset>


... gdzie tutaj jest blad chce zeby jak wchodze (odswierazam strone ) to pokazywala mi sie tylko jedna opcja bez roznicy ktora a tu jak wchodze to sa dostepne oby dwie topiero jak klikne to jest ta co zaznaczylem .... sciana.gif
sp_
Musisz ukryć jedną z opcji nadając jej początkowy styl 'display: none;'
djbarca
he questionmark.gif blinksmiley.gif w ktorym miejscu to wstawic smile.gif
qqrq
A na przykład tu:

  1. <input type="radio" checked name="what" value="opcja1" id="radio_plugin_opcja1" onclick="if(this.checked) {
  2. hide_them_all(); document.getElementById('opcja1_options').style.display = 'block'; }; return true" style="display: none;" />
djbarca
Nie .. nawet jak wstawie tak to i tak nie dziala :/



  1. <script type="text/javascript" language="javascript">
  2. function hide_them_all() {
  3.  
  4. document.getElementById("opcja1_options").style.display = "none";
  5. document.getElementById("opcja2_options").style.display = "none";
  6.  
  7. }
  8.  
  9.  
  10.  
  11. <input type="radio" checked name="what" value="opcja1" id="radio_plugin_opcja1"
  12.  
  13. onclick="if(this.checked) {hide_them_all();
  14. document.getElementById('opcja1_options').style.display = 'block'; }; return true"
  15.  
  16. style="display: none;" />
  17.  
  18.  
  19.  
  20. <input type="radio" name="what" id="radio_plugin_opcja2" onclick="if(this.checked) {
  21. hide_them_all(); document.getElementById('opcja2_options').style.display = 'block'; };
  22. return true"/>Opcja2
  23.  
  24.  
  25.  
  26. <fieldset id="opcja1_options" class="options"><legend>Widoczne opcje jeden
  27.  
  28. :)</legend>tutaj wszystko co do opcji 1</fieldset>
  29.  
  30. <fieldset id="opcja2_options" class="options"><legend>Widoczne opcje dwa :)</legend>tutaj
  31.  
  32. wszystko co do opcji 2</fieldset>
vokiel
Może tak:
  1. <script type="text/javascript" language="javascript">
  2. function hide_them_all(id) {
  3.  
  4. document.getElementById("opcja1_options").style.display = "none";
  5. document.getElementById("opcja2_options").style.display = "none";
  6.  
  7. document.getElementById("opcja" + id + "_options").style.display = "block";
  8. }
  9.  
  10. <input type="radio" name="what" value="opcja1" id="radio_plugin_opcja1" checked onclick="hide_them_all(1)"/>
  11. <label for="radio_plugin_opcja1">Opcja 1</label>
  12.  
  13. <input type="radio" name="what" value="opcja2" id="radio_plugin_opcja2" onclick="hide_them_all(2);"/>
  14. <label for="radio_plugin_opcja2">Opcja 2</label>
  15.  
  16. <fieldset id="opcja1_options" class="options" style="display: block;"><legend>Widoczne opcje jeden :)</legend>tutaj wszystko co do opcji 1</fieldset>
  17. <fieldset id="opcja2_options" class="options" style="display: none;"><legend>Widoczne opcje dwa :)</legend>tutaj wszystko co do opcji 2</fieldset>


Albo możesz też w pętli, gdzie będziesz zmieniał display na none dla każdego elementu, chyba, że trafi się o takim samym id jak ten przekazany do funkcji, to wtedy display block.
djbarca
o wlasnie o cos takiego mi chodzi smile.gif dzieki smile.gif ... yahoo.gif
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.