Salve a tutti,
Ho un Piccolo problema... Sto facendo uno Script per l'aggiunta file, e siccome ho fatto tutta la struttura del form con le tabelle (non avevo molta voglia di fare un layout table-less...)
cmq ho creato una struttura del genere:
codice:
<table width="80%">
<tr>
<td>Screenshot</td>
<td>h**p://</td>
</tr>
<tr>
<td>Dimensione File</td>
<td>20MB</td>
</tr>
</table>
ecc...
ora io tramite un tasto a cui collego la funzione addScreen, vorrei aggiungere sotto a screenshot, screenshot 2
codice:
<table width="80%">
<tr>
<td>Screenshot</td>
<td>h**p://</td>
</tr>
<tr>
<td>Screenshot 2</td>
<td>h**p://</td>
</tr>
<tr>
<td>Dimensione File</td>
<td>20MB</td>
</tr>
</table>
non sapendo come fare ad aggiungere una riga di tabella... ho messo un div dopo il "</tr>" di screenshot con id="otherss"..
ed ho scritto la funzione:
codice:
function addScreen()
{
var elemento = prendiElementoDaId("otherss");
var numer = 0;
var numero = prendiElementoDaId("numss"); // un campo hidden ke conta il numero di campi da aggiungere...
numer = Number(numero.value) + 1;
numero.value = numer
var i = 1;
var input = "";
if(numer >= 2)
{
for(i=2;i<=numer;i++)
{
input += '<tr><td ><span class="titolo">ScreenShot </span>('+i+')<span class="titolo">:</span></td><td ><input class="dati" name="screenshot'+i+'" type="text" value="http://" />[img]images/piu.jpg[/img]</td></tr>';
}
elemento.innerHTML = input;
}
}
ma così facendo, invece di andare nel div "elemento", vanno prima di <table>...come mai?
ci sono altri modi per attaccare una riga di tabella dove si vuole?
Spero di Essermi Spiegato bene!