Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/10/2007, 08:22
serius29
 
Fecha de Ingreso: octubre-2007
Ubicación: en santiago chile
Mensajes: 34
Antigüedad: 16 años, 6 meses
Puntos: 0
iframe con timer

el siguiente codigo hace que dentro de un iframe vayan viendose distintas paginas web que van cambiando cada cierto tiempo. las paginas que puse son solo como ejemplos no estoy promoviendo nada (fueron las primeras que se me ocurrieron). el codigo funciona bien pero hay cosa que quiero implementar a este codigo, al final del codigo les planteo mis inquietudes

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Window-target" content="_top" >
<title>visitando paguinas </title>
<script language="JavaScript">
<!--
function loadIframe(iframeName, url) {

if ( window.frames[iframeName] ) {
window.frames['veamos'].location = url;
return false;
}
else return true;
}
-->
</script>

<script>

</script>

<SCRIPT LANGUAGE = "JavaScript">
<!--
var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
{
// Set the length of the timer, in seconds
secs = 60
StopTheClock()
StartTheTimer()
}

function StopTheClock()
{
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}

function StartTheTimer()
{
if (secs==0)
{
StopTheClock()
// Here's where you put something useful that's
// supposed to happen after the allotted time.
// For example, you could display a message:
//alert("hola cada 10 seg")
InitializeTimer();
}
else
{
self.status = secs
secs = secs - 1
timerRunning = true
timerID = self.setTimeout("StartTheTimer()", delay)
if (secs == 60)
{
window.frames['veamos'].location = 'http://www.fororsdelweb.com' ;

}
if (secs == 45)
{
window.frames['veamos'].location = 'http://www.youtube.com/';
}
if (secs == 30)
{
window.frames['veamos'].location = 'http://www.google.cl/';
}
if (secs == 15)
{
window.frames['veamos'].location = 'http://www.meebo.com/';
}
}
}
//-->
</SCRIPT>

<!--

-->
</style>

</head>


<a href="http://www.youtube.com/" onclick="return loadIframe('veamos', this.href)"></a>
<a href="http://www.google.cl/" onclick="return loadIframe('veamos', this.href)"></a>
<a href="http://www.meebo.com/" onclick="return loadIframe('veamos', this.href)"></a>
<body onload="InitializeTimer();" >


<iframe name="veamos" src="http://www.forosdelweb.com" width="975" height="610" scrolling="no" frameborder="0"></iframe>
</body>
</html>

este codigo funcion sin problemas se ve hasta bonito, pero como nada puede ser perfecto tiene un solo problema, cuando alguien quiere navegar en una de las paginas que se muestran lo puede hacer solo dentro del iframe y mientras le dure el tiempo antes que cambie a la siguiente pagina, aqui es donde solicito su ayuda. ¿Como puedo hacer que para cuando alguien presion algun link de la pagina mostrada en el iframe se direcione a esa pagina en una nueva ventana? si alguien me puede ayudar se lo agradeceria, he buscado por varios sitios y no he encontrado la solucion, de hecho no he encontrado ningun ejemplo como el mio. bueno desde ya muchas gracias