Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [js][css] visibility hidden
hondek
post 29.09.2007, 11:01:57
Post #1





Grupa: Zarejestrowani
Postów: 355
Pomógł: 50
Dołączył: 20.08.2007
Skąd: Częstochowa

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


Chce zrobic chowające się menu, ale nie chce mi sie chowac smile.gif w style.css mam ustwione visibility: hidden;
  1.  function menu(id) {
  2.      if (document.getElementById(id).style.visibility='hidden') {
  3.          document.getElementById(id).style.visibility='visible';
  4.          document.getElementById(id).style.height='100px';
  5.      }
  6.      else {
  7.          document.getElementById(id).style.visibility='hidden';
  8.          document.getElementById(id).style.height='0px';
  9.          return
  10.      }
  11.  }
  12.  


i html :

  1. <div onclick=" menu('ok') " class="menu">Menu</div>


Menu laduje sie schowane, jak klikne to sie rozwija winksmiley.jpg ale jak klikne ponownie to sie nie zwija... sad.gif
Proszę o pomoc, z góry dziekuję.


--------------------
przetwornik yt na czasie :)
Go to the top of the page
+Quote Post
nevt
post 29.09.2007, 11:08:54
Post #2





Grupa: Przyjaciele php.pl
Postów: 1 595
Pomógł: 282
Dołączył: 24.09.2007
Skąd: Reda, Pomorskie.

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


Może to bez znaczenia... ale dlaczego return jes tylko w bloku else ? powinien być po całym if , no i brakuje po nim średnika... koże dlatego blok else nie działa?

Pozdrawiam.


--------------------

-
Oh no, my young coder. You will find that it is you who are mistaken, about a great many things... -
Go to the top of the page
+Quote Post
hondek
post 29.09.2007, 11:14:50
Post #3





Grupa: Zarejestrowani
Postów: 355
Pomógł: 50
Dołączył: 20.08.2007
Skąd: Częstochowa

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


pomyłka winksmiley.jpg return mialo nie być smile.gif bez tego też się nie chowa:(
Błąd tkwi gdzieś indziej.


--------------------
przetwornik yt na czasie :)
Go to the top of the page
+Quote Post
Stalos
post 3.10.2007, 18:50:25
Post #4





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 28.12.2006

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


  1. var zmienna_globalna = 1;
  2.  
  3. function menu(id) {
  4. var element = document.getElementById(id);
  5. if (zmienna_globalna == 0){
  6. element.style.visibility='visible';
  7. element.style.height='100px';
  8. zmienna_globalna = 1;
  9. return true;
  10. }
  11. else{
  12. element.style.visibility='visible';
  13. element.style.height='10px';
  14. zmienna_globalna = 0;
  15. return true;
  16.  
  17. }
  18.  
  19. }
  20. </script>
  21. </head>
  22. <div onclick="menu('menu')" id="menu">Menu</div>
  23. document.getElementById('menu').style.background = "red";
  24. </body>
  25.  
  26. </html>


dałem tło czerwone aby widać było jak się zmienia. O to chodziło ?
Go to the top of the page
+Quote Post
hondek
post 5.10.2007, 16:07:21
Post #5





Grupa: Zarejestrowani
Postów: 355
Pomógł: 50
Dołączył: 20.08.2007
Skąd: Częstochowa

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


Tak, o to smile.gif Dziękuje bardzo!


--------------------
przetwornik yt na czasie :)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 11:45