Foros del Web » Programando para Internet » Javascript »

En IE no y en Firefox SI en campo FILE

Estas en el tema de En IE no y en Firefox SI en campo FILE en el foro de Javascript en Foros del Web. Buenas tardes, tengo un pequeño detalle, con este codigo creo campos files dinamicamente,tipo campo1,campo2. Utilizo una funcion que encontre en este foro para validar los ...
  #1 (permalink)  
Antiguo 03/09/2007, 16:12
 
Fecha de Ingreso: noviembre-2005
Ubicación: Torreon Coahuila
Mensajes: 100
Antigüedad: 18 años, 5 meses
Puntos: 1
En IE no y en Firefox SI en campo FILE

Buenas tardes, tengo un pequeño detalle, con este codigo creo campos files dinamicamente,tipo campo1,campo2.
Utilizo una funcion que encontre en este foro para validar los tipos de archivo, el problema es que en IE al validary ve que no es una extension de imagen valida, pues no me borra la direccion de la imagen, en cambio en firefoz si me borra la direccion de la imagen del campo file.

Que instruccion necesito cambiar para que jale en IE??

En firefox todo va perfectamente en IE no

Saludos a todos y gracias ñ_ñ
Código PHP:
<script type="text/javascript">
<!--

function 
addRowToTable()
{
  var 
tbl document.getElementById('tblSample');
  var 
lastRow tbl.rows.length;
  
// if there's no header row in the table, then iteration = lastRow + 1
  
var iteration lastRow;
  var 
row tbl.insertRow(lastRow);
  
  
// left cell
  
var cellLeft row.insertCell(0);
  var 
textNode document.createTextNode(iteration);
  
cellLeft.appendChild(textNode);
  
  
// right cell
  
var cellRight row.insertCell(1);
  var 
el document.createElement('input');
  
el.type 'file';
  
el.name 'archivo' iteration;
  
el.id 'archivo' iteration;
  
el.size 60;
  
el.onchange = new Function("LimitAttach(this,1);");
  
cellRight.appendChild(el);
  
}

function 
removeRowFromTable()
{
  var 
tbl document.getElementById('tblSample');
  var 
lastRow tbl.rows.length;
  if (
lastRow 2tbl.deleteRow(lastRow 1);
}

function 
validateRow(frm)
{
  var 
chkb document.getElementById('chkValidate');
  if (
chkb.checked) {
    var 
tbl document.getElementById('tblSample');
    var 
lastRow tbl.rows.length 1;
    var 
i;
    for (
i=1i<=lastRowi++) {
      var 
aRow document.getElementById('archivo' i);
      if (
aRow.value.length <= 0) {
        
alert('Juzgado ' ' esta vacio');
        return;
      }
    }
  }
  
openInNewWindow(frm);
}
function 
LimitAttach(tField,iType) {
file=tField.value;
if (
iType==1) {
extArray = new Array(".gif",".jpg",".doc",".pdf",".xls");
}
allowSubmit false;
if (!
file) return;
while (
file.indexOf("\\") != -1file file.slice(file.indexOf("\\") + 1);
ext file.slice(file.indexOf(".")).toLowerCase();
for (var 
0extArray.lengthi++) {
if (
extArray[i] == ext) {
allowSubmit true;
break;
}
}
if (
allowSubmit) {
} else {
tField.value="";
alert("Usted sólo puede subir archivos con extensiones " + (extArray.join(" ")) + "\nPor favor seleccione un nuevo archivo");
}
}


//-->

</script>
<FORM name='form' action='resultados.html' method='GET'>
<P>
<INPUT onclick=addRowToTable(); type=button value='Añadir'>
<INPUT onclick=removeRowFromTable(); type=button value='Eliminar'> 
<INPUT onclick=validateRow(this.form); type=button value='Enviar'>
<INPUT id=chkValidate type=checkbox> Validarlos</P>
<input type="checkbox" id="chkValidateOnKeyPress" checked="checked"> Desplegar archivo actual
<span id="spanOutput" style="border: 1px solid #000; padding: 3px;"></span>
</p>
<TABLE id=tblSample border=1>
  <TBODY>
  <TR>
    <TH colSpan=2>Imagenes</TH></TR>
  <TR>
    <TD>1</TD>
 <TD><INPUT type='file' Onchange='LimitAttach(this,1);' id=archivo1 size=60 name=archivo1></TD>

  </TD></TR>
</TBODY></TABLE>
</FORM> 
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:51.