Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/06/2017, 05:30
javiinet
 
Fecha de Ingreso: marzo-2012
Mensajes: 45
Antigüedad: 12 años, 1 mes
Puntos: 0
simple función de javascript no funciona

Hola.
No sé por que no me funciona esta simple función. Lo que pretendo es que me diga el número de ficheros que voy a subir al servidor.
Código HTML:
<!DOCTYPE html>
<html>
<head>
	<script>
			window.onload = function()
			{
				var btn = document.getElement.ById("btn");
				btn.onclick = function()
				{
					var imagen = document.getElement.ById("imagen").files;
					
					alert(imagen.length);
					
					document.formulario.submit();
				}
			}
		
	</script>

</head>
<body>

<form action="" method="post" name="formulario" enctype="multipart/form-data">
  Select images: <input type="file" name="imagen" multiple id="imagen">
  <button type="submit" id="btn">enviar</button>
</form>

<p>Try selecting more than one file when browsing for files.</p>

</body>
</html> 
No hace nada.
Graciasssss