Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Dynamiczne dodawanie elementów w formularzu?
lutar
post
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 30.05.2006

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


Witam, chciałbym zrobić formularz wystawiania faktury na stronie. Myślałem o tym żeby dynamicznie dodawać kolejne pozycje w tej fakturze (np. będzie to pole tekstowe) po naciśnięciu odpowiedniego przycisku. Jeśli ktoś podsunąłbym mi pomysł jak to zrobić byłbym wdzięczny.
Go to the top of the page
+Quote Post
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%)
-----


To co chcesz zrobić dzieje się po stronie przeglądarki, więc przenoszę do bardziej odpowiedniego działu.
Go to the top of the page
+Quote Post
gekon
post
Post #3





Grupa: Zarejestrowani
Postów: 614
Pomógł: 7
Dołączył: 10.11.2003
Skąd: Rzeszów/Kraków

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


Było m.in. tu: http://forum.php.pl/index.php?showtopic=44...66&#entry244266
Go to the top of the page
+Quote Post
merle
post
Post #4





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 4.07.2006

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


  1. <script type="text/javascript">
  2. <!-- <![CDATA[
  3. i=0;
  4. function wstaw() {
  5. i++;
  6. var tekst = document.createTextNode('pole '+i+': ');
  7. var input = document.createElement('input' );
  8. input.setAttribute('type', 'text');
  9. input.setAttribute('name', 'p'+i);
  10. input.setAttribute('size', '4');
  11. var br = document.createElement('br');
  12. var div = document.createElement('div');
  13. div.appendChild(tekst);
  14. div.appendChild(input);
  15. div.appendChild(br);
  16. document.getElementById('pola').appendChild(div);
  17.  
  18.  
  19.  
  20.  
  21. }
  22. // ]]> -->
  23. <script type="text/javascript">
  24. <!-- <![CDATA[
  25. j=0;
  26. function wstaw2() {
  27. j++;
  28. var tekst = document.createTextNode('polee '+j+': ');
  29. var input = document.createElement('input');
  30. input.setAttribute('type', 'text');
  31. input.setAttribute('name', 'a'+j);
  32. var br = document.createElement('br');
  33. var div = document.createElement('div');
  34. div.appendChild(tekst);
  35. div.appendChild(input);
  36. div.appendChild(br);
  37. document.getElementById('pola2').appendChild(div);
  38. }
  39. // ]]> -->
  40.  
  41. <form action="index5.php" method="post">
  42. <p><input type="button" value="wstaw nowe pole" onclick="wstaw(),wstaw2()" /></p>
  43. <TD><div id="pola">
  44. </div></TD>
  45. <TD><div id="pola2" >
  46. </div></TD>
  47. <p><input type="submit" value="wyślij pola" /></p>
  48. </form>



tak na wszelki wypadek jakby ktos potrzrebowal

Ten post edytował merle 14.07.2006, 09:02:22
Go to the top of the page
+Quote Post

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.08.2025 - 10:51