Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript]Pokaż/Ukryj dwa elementy
Meferot
post 6.11.2010, 12:03:00
Post #1





Grupa: Zarejestrowani
Postów: 64
Pomógł: 0
Dołączył: 31.08.2009

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


Próbuje zrobić scrypt ktory będzie zajmował się pokazywanie jednego diva, a jednoczesnie ukrywaniem drugiego, mam cos takiego:
  1. <script type="text/javascript">
  2. function pokazUkryj(type1)
  3. {
  4. document.getElementById(type1).style.display = (document.getElementById(type1).style.display == "none") ? "block" : "none";
  5. document.getElementById(type2).style.display = (document.getElementById(type2).style.display == "block") ? "none" : "block";
  6. }
  7. </script>


Nie wiem jak to poprawic zeby dzialalo
Go to the top of the page
+Quote Post
pyro
post 6.11.2010, 12:05:40
Post #2





Grupa: Zarejestrowani
Postów: 2 148
Pomógł: 230
Dołączył: 26.03.2008

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


Nie widzę tu nigdzie zadeklarowanej zmiennej type2.


--------------------
ET LINGUA EIUS LOQUETUR IUDICIUM
Go to the top of the page
+Quote Post
Ghost_78
post 6.11.2010, 12:40:13
Post #3





Grupa: Zarejestrowani
Postów: 222
Pomógł: 34
Dołączył: 3.11.2010

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


a moze tak :
  1. <script type="text/javascript">
  2. function pokazUkryj()
  3. {
  4. document.getElementById('type1').style.display = (document.getElementById('type1').style.display == "none") ? "block" : "none";
  5. document.getElementById('type2').style.display = (document.getElementById('type2').style.display == "block") ? "none" : "block";
  6. }
  7. </script>


--------------------
Always look on the bright side of life ;-)
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: 8.07.2025 - 21:27