Jump to content


Photo

Imagem Aleatória


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

#1 Chetspop HP

Chetspop HP

    Novato no fórum

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

Posted 21/09/2003, 20:56

Seguinte:

O site do meu jogo é http://www.zecaejuca.kit.net

Eu gostaria de saber, se tem como, cada vez que entrar na página, aquelas duas imagens mudarem, mas sem repetir as imagens nas duas... tipo, na img da esquerda, vai da imagem01 até imagem05 e na da direita vai de imagem06 até imagem10... e que possa mudar o link das imagens tbm...

Tem como fazer isso em HTML?

#2 Guilherme Blanco

Guilherme Blanco

    Loading...

  • Conselheiros
  • 891 posts
  • Sexo:Masculino
  • Localidade:São Carlos - SP/Brasil
  • Interesses:Programação Web e minha namorada (Maria Camila).

Posted 21/09/2003, 23:54

Bem... vc quer um banner rotator (que ele altera sozinho, a cada X segundos) ou só um banner aleatório?

Se for um banner rotator, eu tenho um sistema pronto aki. Ei-lo:

<HTML>
  <HEAD>
    <TITLE>Banner Rotator</TITLE>
    <STYLE>
      A.bannerrotator:link { text-decoration: none; color: black; font-weight: bold; }
      A.bannerrotator:visited { text-decoration: none; color: black; font-weight: bold; }
      A.bannerrotator:active { text-decoration: none; color: black; font-weight: bold; }
      A.bannerrotator:hover { text-decoration: none; color: orange; font-weight: bold; }
    </STYLE>
    <script>
      function grabElement( sId ) {
        if(document.getElementById) { return document.getElementById(sId); }
        else { if(document.all) { return document.all[sId]; }
        else { return document.layers[sId]; } }
      }

      var numLinks = posCorrente = -1;
      var timer = 5; // tempo default (em segundos)
      var imgWidth = 468; // Largura default (em pixels)
      var imgHeight = 60; // Altura default (em pixels)
      var banners = new Array();

      bannerRotator = new Object();
      bannerRotator.create = createBannerRotator;
      bannerRotator.add = addBannerRorator;
      bannerRotator.setTimer = setTimerBannerRotator;
      bannerRotator.setWidth = setWidthBannerRotator;
      bannerRotator.setHeight = setHeightBannerRotator;
      bannerRotator.init = initBannerRotator;

      function createBannerRotator() {
        document.write("<DIV ID='bannerRotator'>&nbsp;</DIV>");
      }

      function addBannerRorator( sText, sURL, sTarget ) {
       banners[++numLinks] = new Array( sText, sURL, sTarget );
      }

      function setTimerBannerRotator( sTimer ) {
        timer = sTimer;
      }
      
      function setWidthBannerRotator( iWidth ) {
        imgWidth = iWidth;
      }

      function setHeightBannerRotator( iHeight ) {
        imgHeight = iHeight;
      }

      function initBannerRotator() { bannerUpdate(); }

      function bannerUpdate() {
        if(++posCorrente == numLinks+1) { posCorrente = 0; }
        if( banners[posCorrente][2] == undefined ) {
          grabElement('bannerRotator').innerHTML = "<A CLASS='bannerrotator' HREF='"+banners[posCorrente][1]+"'><IMG SRC='"+banners[posCorrente][0]+"' BORDER='0' WIDTH='"+imgWidth+"' HEIGHT='"+imgHeight+"'></A>";
        } else {
          grabElement('bannerRotator').innerHTML = "<A CLASS='bannerrotator' HREF='"+banners[posCorrente][1]+"' TARGET='"+banners[posCorrente][2]+"'><IMG SRC='"+banners[posCorrente][0]+"' BORDER='0' WIDTH='"+imgWidth+"' HEIGHT='"+imgHeight+"'></A>";
        }
        setTimer();
      }

      function setTimer() {
        window.setTimeout("bannerUpdate()", timer*1000);
      }
    </SCRIPT>
  </HEAD>

  <BODY>
    <script>
      bannerRotator.create();
      bannerRotator.setTimer(3); // Definindo tempo de troca
      bannerRotator.setWidth(120); // Definindo largura
      bannerRotator.setHeight(180); // Definindo altura
      bannerRotator.add("cade.jpg", "http://www.cade.com.br", "_blank");
      bannerRotator.add("yahoo.gif", "http://www.yahoo.com.br");
      bannerRotator.add("teste2.png", "teste2.html", "nome_de_janela_popup");
      bannerRotator.add("funcionando.bmp", "about:blank", "_blank");
      bannerRotator.init();
    </SCRIPT>
  </BODY>
</HTML>

Qualquer dúvida, entre em contato comigo...

[]s,
<script language="WebFórum">
// Dados:
Nome("Guilherme Blanco");
Localidade("São Carlos - SP/Brasil");
Cargo("Manutenção");
</script>




1 user(s) are reading this topic

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

IPB Skin By Virteq