Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JS] Wybór diva z listboxa.
Rewil
post
Post #1





Grupa: Zarejestrowani
Postów: 175
Pomógł: 0
Dołączył: 19.09.2009

Ostrzeżenie: (10%)
X----


Potrzebuję coś takiego uzyskać że jak wybiorę z listboxa jakąś wartość to w zależności od niej wyświetli mi innego diva.(Ukryje jednego, pokaze drugiego)
  1. <script type="text/javascript">
  2. function Pole(document.baner_form.elements['kamp_nazwa'].value) {
  3. if (document.baner_form.elements['kamp_nazwa'].value=="HTML"){
  4. document.getElementById(file_html).style.display = "block";
  5. document.getElementById(file_obra).style.display = "none";
  6. }else{
  7. document.getElementById(file_html).style.display = "none";
  8. document.getElementById(file_obra).style.display = "block";
  9. }
  10.  
  11. }
  12. </script>
  13. <div class="file_wgr">
  14. <div class="file_1">Rodzaj:
  15. <select name="kamp_nazwa[]" size="1" onChange="jump(this.form)">
  16. <option value="Obrazek">Obrazek</option>
  17. <option value="Flash">Flash</option>
  18. <option value="HTML">HTML</option>
  19. </select>
  20. </div>
  21. <div id="file_obra" class="file_2">
  22. Obrazek:
  23. <input type="hidden" name="MAX_FILE_SIZE" value="3145728000" />
  24. <input type="file" size="36" class="file" name="kamp_obrazek[]" />
  25. </div>
  26. <div id="file_html" class="file_2">
  27. Kod HTML:
  28. <textarea name="kamp_kod[]"></textarea>
  29. </div>
  30. </div>
  31.  

I tak jak w tym wypadku: Wybierze się HTML to pokaże się Kod HTML, lub jeśli obrazek to się pokaża Obrazek.
Odrazu mówię że JS to narazie dla mnie czarna magia ;/.
Go to the top of the page
+Quote Post

Posty w temacie


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 - 20:35