Esse é meu codigo, so to com dois problemas. <_< Bom ele num está funcionando direito no IE. no FF funciona que é uma beleza. O outro problema e que se eu tentar inserir mais uma input depois de já ter escolhido as minhas imagens ee some alguém tem alguma ideia de como fazer isso. queria fazer algo tipo o email do google de anexo. poderiam mde ajuda?! <script type="text/javascript">
function valida (){
var f = document.form_foto
f.submit();
}
var n = 2;
function add_input(){
array = new Array();
inputs = document.getElementsByTagName('input');
for(i=0;i<inputs.length;i++){
if(inputs[i].type == "file"){
array[i] = inputs[i].value;
}
}
if (n<=20){
document.getElementById("ft").innerHTML += "<tr><td class='font12BR'>Foto "+n+":</td><td><input type='file' name='file[]' class='borda12'></td></tr>"
n++;
for(i=1;i<array.length;i++){
inputs[i].value = array[i];
}
} else {
alert('Não pode ser criado mais campos');
document.getElementById("add").innerHTML = ""
}
}
</script>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
}
-->
</style>
<form method="post" action="trata_incluir_fotos.php" name="form_foto" enctype="multipart/form-data">
<input type="hidden" name="cod_imovel" value='<?= $cod ?>'>
<table width="550" align="center">
<tr>
<td class='titulo2' colspan="2">Incluir Fotos</td>
</tr>
<tr>
<td class="font12BR" width="20%">Foto 1:</td>
<td><input type="file" name='file[]' class="borda12"></td>
</tr>
<tr>
<td colspan="2" width="106"><span id='ft'></span> </td>
</tr>
<tr>
<td align="right"><input type="button" value="OK" class="font12B" onClick="valida()"></td>
<td><span id='add'><a href='#' onClick="add_input()">Adicionar campo</a></span></td>
</tr>
</table>
</form>