Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/06/2004, 14:31
Avatar de Carlitos
Carlitos
Usuario no validado
 
Fecha de Ingreso: mayo-2001
Ubicación: Zaragoza
Mensajes: 1.304
Antigüedad: 23 años
Puntos: 25
Hola

Aquí tienes el código modificado.
Código:
<html> 
<head> 
    <title>Selección de Banners Aleatorios</title> 
</head> 
 
<SCRIPT LANGUAGE="JavaScript"> 
// Realizado por: Fabian Muller
// WebExperto.com - Ayuda al webmaster en español 
// Modificado por KarlanKas 
// Re modificado por Carlitos

function pinta() 
{
width="468"; //Anchura del banner 
height="60"; //Altura del banner 

banners= new Array(); 
banners[0]="banner1.gif"; 
banners[1]="banner2.gif"; 
banners[2]="banner3.swf"; 
banners[3]="banner4.gif"; 
banners[4]="banner5.swf"; 

totalbanners = banners.length; 
var ahora = new Date() 
var segundos = ahora.getSeconds() 
var ad = segundos % totalbanners; 
seleccionado=banners[ad]; 
localizador=seleccionado.lastIndexOf('.'); 
localizador2=localizador+4 
extension=seleccionado.substring(localizador+1,localizador2); 
archivo=seleccionado.substring(0,localizador); 

document.write("<center>"); 
if (extension=="swf"){ 
flash=seleccionado; 
document.write('<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=' + width + ' height=' + height + ' CODEBASE=\"http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0\">'); 
document.write('<PARAM NAME=\"MOVIE\" VALUE=\"' + flash + '\">'); 
document.write('<PARAM NAME=\"PLAY\" VALUE=\"true\">'); 
document.write('<PARAM NAME=\"LOOP\" VALUE=\"true\">'); 
document.write('<PARAM NAME=\"QUALITY\" VALUE=\"high\">'); 
document.write('<EMBED SRC=' + flash + ' width=' + width + ' height=' + height + ' PLAY=\"true\" LOOP=\"true\" QUALITY=\"high\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi? P1_Prod_Version=ShockwaveFlash\">'); 
document.write('</EMBED>'); 
document.write('</OBJECT>');} 
else {document.write('<img src='+seleccionado+' width='+width+' height='+height+'>'); 
document.write('</center>');} 
}
 

</SCRIPT> 


<body>
<table border="1">
<tr>
<td>
<script>pinta()</script>
</td>
</tr>
</table>
</body> 
</html>
Te cuento. Lo que he hecho es meter todo el código en una función. Para que la puedas llamar desde y cuando quieras.
Para llamarla, debes poner esta línea.
Código:
<script>pinta()</script>
Fíjate que en ejemplo, la llamo desde dentro de una celda.
Código:
...
<td>
<script>pinta()</script>
</td>
...
A ver si te sirve.

Un saludo.