Jump to content


Photo

Banners, Rotators


  • Faça o login para participar
1 reply to this topic

#1 WmGuto

WmGuto

    Novato no fórum

  • Usuários
  • 7 posts
  • Sexo:Não informado

Posted 26/01/2004, 00:34

preciso que me ensinem a fazer um código, que faça com que os Banners fiquem rodando de forma aleatória, mas que haja um tempo para cada um, quero isso em um código de Java script.

Eu tenho um código ele é o seguinte, mas faz muito tempo que eu não mecho com programação e estou precisando e necessitando de uma explicação passo a passo.

o código é o seguinte:

<script>

<!-- written by The Omega

//  http://members.xoom.com/the_omega/

//  the_omega@geocities.com

// You must leave these comments in to use the script

//  (hey, I wrote it. Let me have a little credit!)



// put info for randomly selected banners here, as in the examples

gfx0="banner1.gif";

lnk0="page1.html";

alt0="Alt code 1";

txt0="Tagline 1";

gfx1="banner2.gif";

lnk1="page2.html";

alt1="Alt code 2";

txt1="Tagline 2";

gfx2="banner3.gif";

lnk2="page3.html";

alt2="Alt code 3";

txt2="Tagline 3";

len=3;  // change to equal number of banners



today=new Date();

today=today.getTime()/10;

rnd=today%len;

document.writeln('<A HREF="'+eval("lnk"+rnd)+'"><IMG SRC="'+eval("gfx"+rnd)+'" ALT="'+eval("alt"+rnd)+'"><BR>'+eval("txt"+rnd)+'</A>');

//-->

</SCRIPT>


O outro é o seguinte:

<!-- --><script LANGUAGE="JavaScript">

<!-- Hide from JavaScript-Impaired Browsers
/* First, if you load fewer or more than 6 sponsors
  into your rotator, change the "number_of_sponsors" variable
  to the actual number of sponsor .gifs you plan to
  load. */
  number_of_sponsors=6;

var sctr=0;
var halt=0;
var isn=new Array();
for (i=0;i<number_of_sponsors;i++){
isn[i]=new Image();
}

/* The sponsor .gif names are loaded into the isn[x]
  sponsor images array.  You may load any number of
  sponsor images (.gif or .jpg or both) into this
  array. They must all be the same size, however.
  Substitute your own .gif filenames for the ones
  shown here. Note that the first .gif must appear
  in the isn[0] array element. */
isn[0].src="http://www.yourplace/netad.gif";
isn[1].src="http://www.yourplace.gif";
isn[2].src="http://www.yourplace.gif";
isn[3].src="http://www.yourplace.gif";
isn[4].src="http://www.yourplace.gif";
isn[5].src="http://www.yourplace.gif";

/* Finally, replace the URL's below with those of
  your sponsors IN THE SAME ORDER. */
var durl=new Array();
durl[0]="http://www.adobe.com/aic/";
durl[1]="http://www.pacificco...try.infohiway";
durl[2]="http://www.infohiway...com/webwalker";
durl[3]="http://info.netscape....com/sban11_e";
durl[4]="http://www.infohiway...cript/hts.htm";
durl[5]="http://www.pentax.com/";

/* This script is set to rotate every 10 seconds.
  (5000=5 seconds, so 30000 would equal 30, etc)
  You should change the number in the setTimeout()
  call below for the number of seconds you wish. */
function rotateIt(){
if (halt!=1){
  sctr++;
  if (sctr>number_of_sponsors-1){
  sctr=0;
  }
  document.sponsor.src=isn[sctr].src;
  setTimeout("rotateIt()",10000);
  }
}

/* This code will work just fine with or without
  frames.  However, if you are in frames and wish
  to replicate the TARGET="_top" call to remove
  frames, change the location.href call to:
    parent.location.href=durl[sctr];
  below. */
function doIt(){
halt=1;
location.href=durl[sctr];
}

function dispIt(){
parent.window.status=durl[sctr];
}
// End Hiding -->

</SCRIPT>

<center><table BORDER=0 CELLSPACING=0 CELLPADDING=0 >
<tr>
<td><a href="http://your url.html" onClick="doIt();return false" onMouseover="dispIt();return true;"><img SRC="http://whatever the name is.gif" NAME="sponsor" BORDER=0 height=60 width=468></a></td>
</tr>
</table></center>
<!-- this script and more free from a1javascripts.com -->


===========================================
===========================================
PLEASE NOTE: this last part must be placed at the bottom of the page.

<!-- -->
<script LANGUAGE="JavaScript">
<!-- Hide JavaScript from Java-Impaired Browsers
sctr=0;
rotateIt();
// End Hiding -->
</SCRIPT>
<!-- -->



Sei que nesses códigos há duas etapas, ou pelo menos em um deles, a primeira se coloca no Head e outra no Body, ou as duas no Body, não sei, Pôxa estou me complicando muito.

Ah e o Arquivo do Banner em que lugar tenho que salvar pode ser na mesma pasta das imagens, ou é melhor ter uma pasta só para imgens e outra só para Banners?

Também gostaria de Saber, qual o melhor programa para se fazer Banners, o Photoshop é Bom e o Corel Draw, o Xara web style 2, também é bom?

Estou aprendendo alguma coisa agora, mas vou pedir mais explicações de Banners na próxima pergunta ou após alguma resposta.

Abraços :wacko:

#2 Cristiano Galdino

Cristiano Galdino

    Dark Defender

  • Administradores
  • 3738 posts
  • Sexo:Masculino
  • Localidade:Brasília, DF

Posted 27/01/2004, 02:21

Olha só Guto, mesmo que sua dúvida seja urgente não justifica você postar uma mensagem pra o seu tópico subir de posição.

Se você tivesse feito uma busca teria achado o script que você tanto almeja, na nossa seção de tutoriais de desenvolvimento temos a área DHTML / HTML / XHTML (e sub-seções) e nela temos a seção JavaScript.

Nessa seção JavaScript temos dois tópicos sobre Banners Rotativos, um do Wrathchild e outro do Guilherme Blanco, veja eles no link abaixo:
http://forum.wmonlin...p?showforum=106

Espero que o link ajude.
Cristiano G.
¦-þ
Cristiano Galdino
- http://cristiano.galdino.net/

“Since 2003”





1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq