Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> textarea
barkroli
post 29.03.2006, 08:03:47
Post #1





Grupa: Zarejestrowani
Postów: 79
Pomógł: 0
Dołączył: 23.05.2004

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


Kod
<script type="text/javascript">
var ile = 0;

dodajInput = function(parentElement)
{
  ile++;
  var input   = document.createElement("input");
  input.type  = "text";
  input.name  = "kwota"+ile;
  parentElement.appendChild(input);
}

dodajText = function(parentElement)
{
  var input   = document.createElement("input");
  input.type  = "text";
  input.name  = "ulica"+ile;
  parentElement.appendChild(input);
}

Input = function(parentElement)
{
  var input   = document.createElement("input");
  input.type  = "hidden";
  input.name  = "ile";
  input.value = ile;
  parentElement.appendChild(input);
}

window.onload=function()
{
  var dodaj = document.getElementById('dodajInput');
  if(dodaj)
   {
    dodaj.onclick = function()
     {
      dodajInput(document.getElementById('dowozik'));
      Input (document.getElementById('dowozik'));
      dodajText(document.getElementById('dowozik'));
     }
   }
  else
   {
    return false;
   }
}
</script>

<form name="form" action="" method="POST">
<input type="button" id="dodajInput" value="dodaj pole pliku">
<div id="dowozik">
</div>
<input type="submit" name="x" value="y">
</form>

<?
for ($i=1; $i<=$_POST['ile'];$i++)
{
  echo $i."  --->  ".$_POST['kwota'.$i]."  --->  ".$_POST['ulica'.$i]."<br>";
}
?>


Mam coś takiego udało mi się stworzyć jak teraz zrobić żeby ten input który tworzony jest przez dodajText był <textarea> </textarea>


--------------------
Systemy dedykowane, Magento, Typo3
PascalSystem.pl
Go to the top of the page
+Quote Post
gekon
post 29.03.2006, 15:33:25
Post #2





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

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


Kod
dodajText = function(parentElement)
{
var text  = document.createElement("textarea");
text.name  = "text";
text.cols  = "40";
text.rows  = "15";
parentElement.appendChild(text);
}


Oczywiscie nie możesz zapomnieć o atrybutach rows i cols, które są wymagane.

Ten post edytował gekon 29.03.2006, 15:36:26


--------------------
Pokaż kod = Pokaż CAŁY kod, najlepiej działający na jakimś serwerze.
Fanatycy | glazar.info | semantyka | HTML i XHTML FAQ
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 11:07