Foro de elhacker.net

Programación => Desarrollo Web => Mensaje iniciado por: rolomo en 15 Febrero 2012, 13:42 pm



Título: Visualizar animaciones a la vez en javascript
Publicado por: rolomo en 15 Febrero 2012, 13:42 pm
Es algo relativamente sencillo lo que quiero preguntar, ante todo perdon por mi ignorancia jeej. Tengo un script para visualizar una secuencia de imagenes, hasta aquí todo perfecto. El problema viene cuando quiero hacer otra secuencia de imagenes al lado, es decir, tener 2 secuencia de imagenes en la misma pag. No sé como hacerlo :-(.
Me pueden ayudar?

<html>
<head>
<link href="http://www.sat24.com/image.ashx?country=sp&type=slide&time=&index=11&sat=vis" type="image/x-icon" rel="shortcut icon" />
<meta http-equiv="Refresh" content="150;URL=Models.html" />

<script language="javascript">

var SecuenciaEjecutandose = false
var SecuenciaID = null
var imagen = 12
var duracion = 1000

if (CompruebaVersion()) {
imagenes = new CreaArray(12)

imagenes[1].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl1.gif"

imagenes[2].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl2.gif"

imagenes[3].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl3.gif"

imagenes[4].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl4.gif"

imagenes[5].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl5.gif"

imagenes[6].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl6.gif"

imagenes[7].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl7.gif"

imagenes[8].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl8.gif"

imagenes[9].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl9.gif"

imagenes[10].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl10.gif"

imagenes[11].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl11.gif"

imagenes[12].src = "http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl12.gif"
}

function CompruebaVersion() {
if (navigator.appVersion.charAt(0) >= 5 && document.images) return true
else return false
}

function CreaArray(n) {
this.length = n
for (var i = 1; i<=n; i++) {
this = new Image()
}
return this
}

function DetenerSecuencia (){
if(SecuenciaEjecutandose)
clearTimeout(SecuenciaID)
SecuenciaEjecutandose = false
imagen = 0
}

function MostrarSecuencia () {
if (CompruebaVersion()) {
document.images["secuencia"].src = imagenes[imagen].src
imagen++
if ( imagen == 13)
imagen = 1
}
SecuenciaID = setTimeout("MostrarSecuencia()", duracion)
SecuenciaEjecutandose = true
}

function IniciarSecuencia () {
DetenerSecuencia()
imagen = 1
MostrarSecuencia()
}

document.images.imgAnimada.src ="http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl12.gif"

</script>

</head>

<body bgcolor="#173180" onLoad="IniciarSecuencia()">

<left>

<form name=num1>

<font color="white"><b></b></font>


  <table width="7%"  border="0" cellpadding="1">

    <tr>

      <th bgColor="white" scope="col"><img border="2" src="" width="" height="" alt="Loading, please wait..." name="secuencia">
</th>

    <th bgColor="black" scope="col"><img border="2" src="http://www.meteo.cat/servmet/modelitzacio/gmen00/ptl12.gif" ></th>

    </tr>

  </table>
</form>
</left>


</body>
</html>