Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Drobny problem :)
djbarca
post
Post #1





Grupa: Zarejestrowani
Postów: 231
Pomógł: 1
Dołączył: 22.04.2007
Skąd: Rypin

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


  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 .... (IMG:http://forum.php.pl/style_emoticons/default/sciana.gif)

Ten post edytował djbarca 10.09.2007, 08:37:19
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
sp_
post
Post #2





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 9.09.2007

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


Musisz ukryć jedną z opcji nadając jej początkowy styl 'display: none;'
Go to the top of the page
+Quote Post
djbarca
post
Post #3





Grupa: Zarejestrowani
Postów: 231
Pomógł: 1
Dołączył: 22.04.2007
Skąd: Rypin

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


he (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/blinksmiley.gif) w ktorym miejscu to wstawic (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
qqrq
post
Post #4





Grupa: Zarejestrowani
Postów: 418
Pomógł: 8
Dołączył: 16.11.2006

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


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;" />
Go to the top of the page
+Quote Post
djbarca
post
Post #5





Grupa: Zarejestrowani
Postów: 231
Pomógł: 1
Dołączył: 22.04.2007
Skąd: Rypin

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


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>
Go to the top of the page
+Quote Post
vokiel
post
Post #6





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

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


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.
Go to the top of the page
+Quote Post
djbarca
post
Post #7





Grupa: Zarejestrowani
Postów: 231
Pomógł: 1
Dołączył: 22.04.2007
Skąd: Rypin

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


o wlasnie o cos takiego mi chodzi (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) dzieki (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) ... (IMG:http://forum.php.pl/style_emoticons/default/yahoo.gif)
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: 23.08.2025 - 14:42