Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript]Skrypt który chowa tekst, problem...
Skr3czu
post
Post #1





Grupa: Zarejestrowani
Postów: 215
Pomógł: 0
Dołączył: 12.03.2007

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


Witam,

mam taki skrypt:
Kod
<div ><input type="button" value="1.Czy można mieć 10 samochodów ?" style="width:500px;font-size:10px;margin:0px;padding:0px; margin-right:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = '1.Czy można mieć 10 samochodów ?'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = '1.Czy można mieć 10 samochodów ?'; }">
</div>
<div style="margin: 0px; padding:0px;">
<div style="display: none;">
Tak oczywiście, że można mieć...
</div>
</div>

No i działa dobrze, ale jak go na jednej podstronie umieszczę dwa razy, czyli tak:
Kod
<div ><input type="button" value="1.Czy można mieć 10 samochodów ?" style="width:500px;font-size:10px;margin:0px;padding:0px; margin-right:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = '1.Czy można mieć 10 samochodów ?'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = '1.Czy można mieć 10 samochodów ?'; }">
</div>
<div style="margin: 0px; padding:0px;">
<div style="display: none;">
Tak oczywiście, że można mieć...
</div>
</div>
<br>
<div ><input type="button" value="1.Czy można mieć 10 samochodów ?" style="width:500px;font-size:10px;margin:0px;padding:0px; margin-right:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = '1.Czy można mieć 10 samochodów ?'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = '1.Czy można mieć 10 samochodów ?'; }">
</div>
<div style="margin: 0px; padding:0px;">
<div style="display: none;">
Tak oczywiście, że można mieć...
</div>
</div>

To jakby nie działają...

Co jest nie tak ?
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 19.08.2025 - 18:08