no lenze kam ten input tam chces pridat do tej tabulky?
to su objekty a nie tagy(=> opera a FF sa kaslu na mnoho veci a preto kazdy nadava na IE a robi z neho odpad).
skus to takto
Kód:
<script>
function addEvent() {
var pocet = document.fieldset.length-2;
var max = 6;
if (pocet <= max) {
var tab = document.getElementById("table").insertRow(-1).insertCell(0);
var new_input = document.createElement("input");
new_input.setAttribute("id","picture"+pocet);
new_input.setAttribute("type","file");
new_input.setAttribute("name","picture"+pocet);
tab.appendChild(new_input);
}
else alert("Je mozne uploadnut maxim\xE1lne " + max + " obrazkov");
}
</script>
<fieldset>
<legend>Pridaj inzerat - Krok 2 z 2</legend>
<form action="add.php" onsubmit="return verify_ad()" enctype="multipart/form-data" id="fieldset" name="fieldset" method="post">
<table width="100%" id="table" name=table>
<tr><td>Upload obrazku: povolene formaty: *jpg, *png, *gif<br />{$maxsize}</td></tr>
<tr><td><input type="file" name="picture1" id="picture1" /></td></tr>
</table>
<table>
<tr><td>
<input type="hidden" value="{$smarty.session.id}" name="id" id="id" />
<input type="button" onclick="addEvent();" value="Pridaj upload" /> <input type="submit" value="Pokracuj" /></td></tr>
</table>
</form>
</fieldset>
len si to cele este skonroluj lebo ti to pridava inputy od picture4 po picure 8. neviem ci to tak chces, no length formularu udava asi pocet vsetkych inputov tak tomu mozes odratat dva
Kód:
var pocet = document.fieldset.length-2;
a v podmienke odstran + 2
.