Foros del Web » Programando para Internet » Javascript »

Como Hago Para Rotar Banners?

Estas en el tema de Como Hago Para Rotar Banners? en el foro de Javascript en Foros del Web. Hola: Introduje este escript: <!-- Nota: El siguiente script utiliza las imágenes que se encuentra en la carpeta Exportar. --> <html> <head> <!-- Copiar dentro ...
  #1 (permalink)  
Antiguo 12/07/2002, 20:34
 
Fecha de Ingreso: diciembre-2001
Mensajes: 269
Antigüedad: 22 años, 5 meses
Puntos: 0
Como Hago Para Rotar Banners?

Hola:
Introduje este escript:


<!--
Nota: El siguiente script utiliza las imágenes que se encuentra en la carpeta Exportar.
-->

<html>
<head>
<!-- Copiar dentro del tag HEAD -->
<script LANGUAGE="JavaScript">
<!-- Creador: Markus Fischer ([email protected]) -->
<!-- Sitio Web: http://josefine.ben.tuwien.ac.at/~mfischer/ -->

<!-- Comienza
var mfBanners = [
['http://www.banner1-url-here.com', 'ban1.gif'],
['http://www.banner2-url-here.com', 'ban2.gif']
];
var mfIe = false;
if( document.all) {
mfIe = true;
}
var mfBannerIndex = 0;
function mfBannerChange() {
var htmlString = '<a target="_blank" href="'+mfBanners[mfBannerIndex][0]+'"> <img border="0" src="'+mfBanners[mfBannerIndex][1]+'"></a>';
if( mfIe) {
document.all.banner.innerHTML = htmlString;
}
else {
document.layers["banner"].document.open();
document.layers["banner"].document.write( htmlString);
document.layers["banner"].document.close();
}
if(mfBannerIndex < mfBanners.length - 1)
mfBannerIndex++;
else
mfBannerIndex = 0;
}
setInterval("mfBannerChange()", 3000);
// End -->
</script>

</head>

<body>
<!-- Copiar dentro del tag BODY -->
<div id="banner"></div>
</body>
</html>

El problema es q me coloca el banner,la rotacion,al final de la pagina,y yo quiero que lo haga arriba de la pagina,como lo cambio?
O si sabeis de algun otro script,eso si,sencillito,para la rotacion de banners,me lo decis.
Gracias
  #2 (permalink)  
Antiguo 12/07/2002, 20:57
 
Fecha de Ingreso: diciembre-2001
Mensajes: 302
Antigüedad: 22 años, 5 meses
Puntos: 1
Re: Como Hago Para Rotar Banners?

Te doy el código que yo utilizo, es mucho más sencillo:
Código:
 <!-- Begin
var how_many_ads = 3;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % how_many_ads;
ad +=1;
if (ad==1) {
url="http://www.mercadolibre.com.co/colombia/ml/pms?site=220666&id=3437&go=REG";
alt="Regístrate y haz mucho dinero MercadoLibre.com";
banner="http://pms.mercadolibre.com/cgi/pms/ban?site=220666&id=3437";
width="468";
height="60";
}
if (ad==2) {
url="http://www.mercadolibre.com.co/colombia/ml/pms?site=220666&id=3084&go=REG ";
alt="Regístrate y haz mucho dinero MercadoLibre.com";
banner="http://pms.mercadolibre.com/cgi/pms/ban?site=220666&id=3091";
width="468";
height="60";
}
if (ad==3) {
url="http://www.iespana.es/zonacronica/teens/amigos/artemis_fowl.htm";
alt=">[Artemis Fowl, el Harry Potter Malo]";
banner="http://www.iespana.es/zonacronica/banners/artemi_full_468x60.gif";
width="468";
height="60";
}
document.write('<center>');
document.write('<a href=\"' + url + '\" target=\"_blank\">');
document.write('<img src=\"' + banner + '\" width=')
document.write(width + ' height=' + height + ' ');
document.write('alt=\"' + alt + '\" border=0><br>');
document.write('</center>');
// End -->
-----
Te lo explico:
> En la línea dos donde dice: var how_many_ads = 3; colocas el número de banners en éste caso 3.
> Abajo en cada uno de ellos vas especificando el banner, la URL donde conduce y el ALT de la imagen. Ëste script está para banner 468x60 los largos horizontales.
> Guárdalo en una archivo '.js' por ejemplo banners.js., así podrás cambiar los banners de tu web y aparacerán modificados en todas las páginas de tu sitio.
> En cada página y en el sitio donde quieres que aparezcan los banners colocas el script..., espérame y lo busco...: Míralo:
Código:
 <script src="banners.js">
</script>
.

<iframe marginwidth="0" marginheight="0" src="http://www.zonacronica.host.sk/sign.htm" frameborder="0" width="380" height="100" scrolling="no"></iframe>
  #3 (permalink)  
Antiguo 12/07/2002, 21:11
Usuario no validado
 
Fecha de Ingreso: julio-2001
Mensajes: 766
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: Como Hago Para Rotar Banners?

o usa este jeje a mi megusta mucho

&lt;script language=&quot;Javascript&quot;&gt;
//for(unknown){[email protected]}
c=0;z=0;
var image = new Array()
var links = new Array()
//indica el tiempo en segundos hasta 0.001
var tiempo=1
/*
Para Agregar mas imagenes y links copia *
la linea que se indican con los sig datos*

[&quot;url del banner&quot;, &quot;imagen del banner&quot;], *

*/

var banners = [
[&quot;http://www.url1.com&quot;, &quot;untitled0.gif&quot;],
[&quot;http://www.url2.com&quot;, &quot;untitled1.gif&quot;],
[&quot;http://www.url3.com&quot;, &quot;untitled2.gif&quot;]
];

function rota()
{
if (z&lt;banners.length)
{
document.getElementById('pl').href=banners[z][0]
document.getElementById('baneer').src=banners[z][1]
z++
}
else z=0;
}
setInterval(&quot;rota();&quot;,tiempo*1000);
&lt;/script&gt;


y pones esto en el lugar que desees que se ponga el banner


&lt;a href=&quot;ban&quot; id=&quot;pl&quot; name=&quot;ban&quot;&gt;&lt;img name=&quot;baneer&quot; width=&quot;400&quot; height=&quot;50&quot; border=&quot;0&quot;&gt;&lt;/a&gt;


sera que yo lo hize
;)

<center><hr size="1" width="100%" noshade><a href=javascript:MsgrApp.LaunchIMUI('gpa36@hotmail. com')>
<strong><font face="courier new" color="#666666" size="2">Contact Me?[/CODE]</strong>
<IMG SRC="http://woertman.org:8080/msn/gpa36" border="0"></A></ce
  #4 (permalink)  
Antiguo 13/07/2002, 20:51
 
Fecha de Ingreso: diciembre-2001
Mensajes: 269
Antigüedad: 22 años, 5 meses
Puntos: 0
Re: Como Hago Para Rotar Banners?

A ver,el script de oscral88 funciona,pero o no funciona como yo pensaba o me entendio mal.
Yo quiero un banner que rote sucesivamente.Q aparezca un banner,que a los pocos segundos cambie a otro,y asi sucesivamente.
Y por lo q he visto,este codigo,es para la rotacion de banner aleatoria cada vez q entremos en la web
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:24.