Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> dynamicznie dodawane pola <input type=file>
lucks
post
Post #1





Grupa: Zarejestrowani
Postów: 143
Pomógł: 0
Dołączył: 5.04.2005

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


chciałbym zeby uzytkownik mogł dodać dowolną liczbę zalączników, ale zeby nowe puste pole wyświetlało sie dopiero po załadowaniu poprzedniego, tak aby nie umieszczać na sztywno powiedzmy 10 pol
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
revyag
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 258
Pomógł: 16
Dołączył: 21.09.2004
Skąd: Kielce

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


Zrób dodatkową zmienną która będzie zliczać inputy.
Kod
var inums = 0;
function AddFile() {
    var diw = document.getElementById('diw');
    var file = document.createElement('input');
    file.type="file";
    filetype.name='file'+inums;
    inums++;
    var br = document.createElement("br");
    diw.appendChild(br);
    diw.appendChild(file);    
    file.addEventListener('onchange',AddFile(),false);
}
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: 27.12.2025 - 12:49