Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JS]Co zrobić ay po dodaniu pliku zmienił się inny div na widoczny
Forum PHP.pl > Forum > Po stronie przeglądarki > JavaScript
pacior
  1. <div>
  2. <label for="content">Załączik 1</label>
  3. <input type="file" name="_file_1" id="_file_1" value="" class="input">
  4. </div>
  5. <div id="file2" style="display: none">
  6. <label for="content">Załączik 2</label>
  7. <input type="file" name="_file_2" id="_file_2" value="" class="input">
  8. </div>

Jeśli mamy taki kod co należy dorobić aby po dodaniu elementu pokazał sie div id=file2
emacieka
  1. <div>
  2. <label for="content">Załączik 1</label>
  3. <input type="file" name="_file_1" id="_file_1" value="" class="input" onChange="showInputFile(this, 'file2')">
  4. </div>
  5. <div id="file2" style="display: none">
  6. <label for="content">Załączik 2</label>
  7. <input type="file" name="_file_2" id="_file_2" value="" class="input">
  8. </div>
  9. function showInputFile( input, divID )
  10. {
  11. if ( input.value != '')
  12. {
  13. document.getElementById( divID ).style.display = 'block';
  14. }
  15. }
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.