Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/03/2013, 13:39
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 17 años, 8 meses
Puntos: 1567
Respuesta: Problemas con un For

Supongo que tu miArray son las imágenes
Aquí estás comentiendo un error

err1.src = miArray[i].src;
la imagen es miArray[i], el segundo src te sobra
err1.src = miArray[i];

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>new Image() js</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. var miArray = ['https://googledrive.com/host/0B5cDQ-G3aVMQMkdaelNsdTZ6TDQ/isabelM/img/forrest-gump-250x350.jpg','https://googledrive.com/host/0B5cDQ-G3aVMQMkdaelNsdTZ6TDQ/isabelM/img/piratas-del-caribe-250x350.jpg','https://googledrive.com/host/0B5cDQ-G3aVMQMkdaelNsdTZ6TDQ/isabelM/img/lo-que-el-viento-250x350.jpg','https://googledrive.com/host/0B5cDQ-G3aVMQMkdaelNsdTZ6TDQ/isabelM/img/gladiador-250x350.jpg','https://googledrive.com/host/0B5cDQ-G3aVMQMkdaelNsdTZ6TDQ/isabelM/img/casablanca-250x350.jpg'];
  9. var num_errores = 5;
  10. window.onload = function(){
  11. var contenedor = document.getElementById('muestras');
  12. for (i=0; i<num_errores; i++){
  13. var err1 = new Image();
  14. err1.src = miArray[i];
  15. // context.drawImage(err1, miArray[i].ubic_x + dif_img, miArray[i].ubic_y);
  16. contenedor.appendChild(err1);
  17.  
  18. }
  19. }
  20. //]]>
  21. </head>
  22. <div id="muestras">
  23. </div>
  24. </body>
  25. </html>

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.