![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 25 Pomógł: 0 Dołączył: 12.11.2004 Ostrzeżenie: (10%) ![]() ![]() |
Problem ze strony testowej LO:
http://lo.tp.boo.pl/ Menu - gdy klikam w menu na dział "Dyrekcja", "Absolwenci" i "Dla uczniów" powinno się rozsunąć i pokazać inne pozycje. No i pokazuje, ale... nie swoje. Przyznam się, że js w ogóle nie znam, ale znam php i pomogło mi to w podrasowaniu scriptu, który znalazłem w programie AAScripter. Domyślnie script działał dobrze, ale powtarzały się identyfikatory, co jest niezgodne z xhtml (i chyba ogólnie z html'em). Jak zrobić by działało to dobrze? Może ma ktoś kod innego, podobnego menu. JS: Kod function change(){ var nr = "0"; if(!document.all) return do { nr++ } while(event.srcElement.id=="header_" + nr){ var nested = document.getElementById("header_" + nr + "_") if (nested.style.display=="none") { nested.style.display='' } else { nested.style.display="none" } } } document.onclick = change HTML: |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Przyjaciele php.pl Postów: 2 258 Pomógł: 16 Dołączył: 21.09.2004 Skąd: Kielce Ostrzeżenie: (0%) ![]() ![]() |
Od razu widać, że kod jest IE only (IMG:http://forum.php.pl/style_emoticons/default/snitch.gif)
A można to zrobić prościej. Kod function change(item){ if(document.getElementById(item.id+"_").style.display=="none") { document.getElementById(item.id+"_").style.display="" } else { document.getElementById(item.id+"_").style.display="none" } } |
|
|
![]() ![]() |
![]() |
Aktualny czas: 3.10.2025 - 05:05 |