problem byl poruszany w innym dziale, ale okazalo sie ze bez js ani rusz.

znalazlem kod, ktory dodaje po kliknieiu dowolnie wiele inputow, troche go zmodyfikowalem (i nie dziala wstydnis.gif )

chce zeby po kliknieciu w link dodawal sie nowy div, najlepiej z roznym id.
moze ktos mi pomoze, w js jestem slaby worriedsmiley.gif

  1. <script type="text/javascript">
  2. window.onload = Laduj;
  3.  
  4. function Laduj()
  5. {
  6. document.getElementById('add_input').onclick = DodajElement;
  7. }
  8.  
  9. function DodajElement()
  10. {
  11. var element = document.createElement('div');
  12.  
  13.  
  14. var liczba = 0;
  15. var ilosc = document.forms['faktura'].elements.length;
  16.  
  17. for (var i = 0; i < ilosc ;i++ )
  18. {
  19. if (document.forms['faktura'].elements[i].id == 'file')
  20. {
  21. liczba += 1;
  22. }
  23. }
  24.  
  25. element.setAttribute('name', 'file-'+(liczba+1));
  26.  
  27. element.style.display = "block";
  28. element.style.margin = "2px";
  29.  
  30. document.forms['faktura'].appendChild(element);
  31.  
  32.  
  33. }
  34.  
  35.  
  36.  
  37. </head>
  38.  
  39. <div><a href="#" id="add_input">dodaj nowe pole typu file</a></div>
  40.  
  41. <form name="faktura" method="post">
  42.  
  43. <div id="file" name="file-1">ggg</div>
  44. </form>
  45.  
  46.  
  47. </body>