<!-- #------------------------------------------------------------------------------- #Data: 25/04/2006 #Programador: Diego Hellas / diegohellas@gmail.com #Descri��o: Banners rotativos #------------------------------------------------------------------------------- --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Sistema de Banners</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> <script language="JavaScript"> function banners(idImg) { //declara��o da vari�veis que ser�o usadas no script var j = 0, banner = "", arrayimg = "", parametros = "", width = "", height = "", BANNERS = new Array() //lista de banners //a ordem de como passar os par�metros tem que ser seguidas, caso for //alterado alguma ordem o script n�o funciona-r� corretamemte //imagens/banner1.jpg = caminho do banner //width=705 = largura que o banner ir� aparecer //height=75 = altura que o banner ir� aparecer //pode ser colocados quantos banners quiser na lista BANNERS[BANNERS.length]='imagens/banner1.jpg?&width=705&height=75'; BANNERS[BANNERS.length]='imagens/banner2.jpg?&width=705&height=75'; BANNERS[BANNERS.length]='imagens/banner3.jpg?&width=705&height=75'; //faz a sele��o de um dos banners j = parseInt(Math.random()*BANNERS.length); j = (isNaN(j))? 0 : j; path = BANNERS[j]; //faz a quebra para pegar os param�tros arrayimg = path.split('?'); parametros = arrayimg[1].split('&'); nomeimg = arrayimg[0]; width = parametros[1].split('='); width = width[1]; height = parametros[2].split('='); height = height[1]; //faz a troca do banners document.getElementById(idImg).src= nomeimg; document.getElementById(idImg).width= width; document.getElementById(idImg).height= height; } //caso voc� deseje que os banners n�o fiquem mudando � s� comentar a linha abixo //para alterar o tempo que ele muda � s� alterar de 15000(15 segundo) para o tempo //que necessitar intervalo = setInterval("banners('img_principal')",15000); </script> </head> <body onload="banners('img_principal');"> <img id="img_principal" src="" width="" height=""> </body> </html>