Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Wyświetlanie określonej ilości pól
Tsiru
post
Post #1





Grupa: Zarejestrowani
Postów: 213
Pomógł: 0
Dołączył: 7.01.2005
Skąd: Nigdzie

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


Witam !
Niezabardzo łapie jeszcze javascript, a potrzebuje prosty skrypt, który by wyświetlał tyle pól , ile podano w innym polu.
czyli coś takiego:

jeżeli w polu wpisane było 3, to żeby wyświetliło się:
Cytat
<input type="file" name="[color="red"]0[/color]" size="40"><br />
<input type="file" name="[color="red"]1[/color]" size="40"><br />
<input type="file" name="[color="red"]2[/color]" size="40"><br />

Pomoże ktoś ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
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%)
-----


Kod
<script type="text/javascript">
function add() {
    var num = document.getElementById("num").value;
    var ifile = '';
    for(i = 0; i < num; i++) {
        ifile += '<input type="file" name="'+i+'" size="40"><br />';
    }
    document.getElementById("files").innerHTML = ifile;
}
</script>

  1. <div id="files">
  2. </div><br />
  3. <input id="num" type="text" />
  4. <button onclick="add()">dodaj</button>
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: 19.12.2025 - 13:43