![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 6 Pomógł: 0 Dołączył: 6.04.2002 Skąd: Lubaczow Ostrzeżenie: (0%) ![]() ![]() |
Witam!
Napisalem prosty skrypt: Kod <script language="javascript"> var countInputs = 0; function dodajInput() { document.getElementById('inputLayer').innerHTML+='<br /><input name="userfile_'+countInputs+'" type="file" />'; countInputs++; } </script> i formularz do tego: Kod <form enctype="multipart/form-data" method="post"> <div id="inputLayer"> <input type="hidden" name="MAX_FILE_SIZE" value="900000" /> </div> <input type="submit" value="Send File" /> </form> <a href="javascript:dodajInput();">Dodaj pole formularza</a> Problem w tym, że klikając w link dodający nowe pole formularza kasuje mi się wcześniej wpisana wartość w innych polach input. Jak to naprawić? |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 6 Pomógł: 0 Dołączył: 10.11.2003 Ostrzeżenie: (0%) ![]() ![]() |
Zmieniasz tekst w divie, a nie tworzysz nowego inputa, do tego sluzy metoda createElement().
Kod function addInput(id) { var oDiv = document.getElementById(id); var oInput = document.createElement("<input type='file'>"); oDiv.appendChild(oInput); return; } a poziej Tym samym sposobem mozna tworzyc dowolnego inputa, tabele, elementy tabeli itp. O to chodzilo? Pozdrowka Serg |
|
|
![]() ![]() |
![]() |
Aktualny czas: 12.10.2025 - 01:55 |