Ver Mensaje Individual
  #4 (permalink)  
Antiguo 27/01/2014, 14:49
viterr
 
Fecha de Ingreso: noviembre-2012
Mensajes: 7
Antigüedad: 11 años, 5 meses
Puntos: 0
Respuesta: no logro comparar dos Canvas

Hola que tal ahora si entiendo un poco mas a ver si te sirve esto

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <html lang="es">
  3. <meta charset="utf-8">
  4. <title>Documento sin título</title>
  5.  
  6.  
  7. </head>
  8.  
  9. <script type="text/javascript">
  10.     var misImagenes = new Array(3);
  11.     for (i=0; i<misImagenes.length;i++){
  12.         misImagenes[i]= "img/0"+i+".jpg";
  13.     }
  14.     var contador = 0;
  15.    
  16.    
  17.     window.onload = function(){
  18.    
  19.    
  20.     cambiarImagen();
  21.     }
  22.     cambiarImagen = function(){
  23.         var imgfija = document.getElementById('foto').src="img/02.jpg";
  24.     if(contador == misImagenes.length){
  25.         contador = 0;
  26.     }
  27.    
  28.     var imgcambia = document.getElementById('fotx').src = misImagenes[contador];
  29.     contador++;
  30.     if(imgfija==imgcambia){
  31.         alert('las imagenes son iguales');
  32.         return;
  33.     }
  34.     setTimeout(cambiarImagen, 3000);
  35.    
  36. }
  37.  
  38.       <h1> Compara una imagen con otras cambiando cada 3 segundos</h1>
  39.       <!-- Esta es la que busco -->
  40.       <img id="foto" style="width:240px; heigth:120px;" src=""/>
  41.       <!-- Esta es la lista de imagenes a comparar -->
  42.       <img id="fotx" style="width:240px; heigth:120px;" src=""/>
  43.   </body>
  44. </body>
  45. </html>