Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 15
  1. #1

    circuito banners a rotazione...

    Salve,
    vorrei creare un circuito di banner a rotazione ad "aggiorna pagina" al mio sito.
    una cosa semplicissima senza script difficili o database ...nella stessa pagina web...
    ho banners di questo tipo:
    <a target=_blank href=http://www.link.it=><img src=http://link.etc= border=0>

    al momento cmq ho tre banner!
    grazie

  2. #2
    proprio come quello a fine pagina del forum...mi rispondete x favore

  3. #3

  4. #4
    grazie...

    mi sai dire però perchè non funziona?



    <script type="text/javascript">
    var RITARDO_SECONDI = 2; //ritardo in sec., banner change time
    var idLink = "myLink"; //id del tag <a> che contiene l'img, id of tag <a> that contains the img.
    var idBanner = "myBanner"; //id tag <img>
    var vettoreBanner =
    new Array
    (
    new Array("http://www.clickpoint.it/db/goto.cp?PRO=18284&ID=6400&SUB", "http://www.clickpoint.it/db/load.cp?PRO=18284&ID=6400&SUB"),//array with url and links, array con urls e link
    new Array("http://www.clickpoint.it/db/goto.cp?PRO=18600&ID=6790&SUB", "http://www.clickpoint.it/db/load.cp?PRO=18600&ID=6790&SUB"),
    new Array("http://www.clickpoint.it/db/goto.cp?PRO=18601&ID=6752&SUB", "http://www.clickpoint.it/db/load.cp?PRO=18601&ID=6752&SUB")
    );
    window.onload = function randomBanner()
    {
    ruotaBanner(); //Inserisce il primo banner , inserts the 1st banner
    setInterval("ruotaBanner();", RITARDO_SECONDI * 1000); //funzione ogni tot secondi (vedi riga 6) function after N seconds (see line 6)
    }
    function ruotaBanner() {
    var rnd = Math.floor(Math.random() * vettoreBanner.length); //Random number, numero random
    //Cambia li link e l'immagine del banner, changes link and banner's image.
    document.getElementById(idLink).href = vettoreBanner[rnd][0];
    document.getElementById(idBanner).src = vettoreBanner[rnd][1];
    }
    </script>



    questo è il sito dove l'ho messo...:
    http://www.bestwallpapers.info/

  5. #5
    Utente di HTML.it
    Registrato dal
    Feb 2006
    Messaggi
    2,620
    i tag img e a che devi mettere nel body li hai messi con gli id specificati nel codice?

    ([img]imgdefault.jpg[/img])

  6. #6
    Originariamente inviato da Simosito
    i tag img e a che devi mettere nel body li hai messi con gli id specificati nel codice?

    ([img]imgdefault.jpg[/img])
    mi ero dimenticato di mettere il body..
    mi spieghi per favore come funziona questa stringa..?
    nel mio caso cosa devo mettere?

  7. #7
    Utente di HTML.it
    Registrato dal
    Feb 2006
    Messaggi
    2,620
    Allora: la stringa in pratica nn è altro che quello che vede l'utente.
    Se js è ATTIVO quella stringa (ke contiene il banner) viene modificata dinamicamente, trasformandosi in uno dei link con immagine indicati nello script.
    Se js è INATTIVO viene visualizzato solo un banner.

    Nel tuo caso devi mettere come href l'url di uno dei banner e come src (di img) l'url del banner.
    NON cambiare l'id.

  8. #8
    ottimo funziona!!
    mi farebbe piu comodo però uno script che funzionasse ad "aggiorna pagina"
    cioè
    mettiamo il caso che il primo banner è unibet..
    un tizio aggiorna la pagina..e esce dada...
    mi sono spiegato?

    grazie e scusa

  9. #9
    Utente di HTML.it
    Registrato dal
    Feb 2006
    Messaggi
    2,620
    prova con:
    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <title>Rotazione casuale banner</title>
    <script type="text/javascript">
    var RITARDO_SECONDI = 2; //ritardo in sec., banner change time
    var idLink = "myLink"; //id del tag <a> che contiene l'img, id of tag <a> that contains the img. 
    var idBanner = "myBanner"; //id  tag <img>
    var vettoreBanner =
    new Array
    (
    new Array("http://www.sito1.it", "http://forum.html.it/forum/images/hotlockfolder.gif"),//array with url and  links, array con urls e link
    new Array("http://www.sito2.it", "http://forum.html.it/forum/images/newfolder.gif"),
    new Array("http://www.sito3.it", "http://forum.html.it/forum/images/hotfolder.gif")
    );
    
    function ruotaBanner() {
    var rnd = Math.floor(Math.random() * vettoreBanner.length); //Random number, numero random
    //Cambia li link e l'immagine del banner, changes  link and banner's image.
    document.getElementById(idLink).href = vettoreBanner[rnd][0];
    document.getElementById(idBanner).src = vettoreBanner[rnd][1];
    }
    </script>
    </head>
    <body onload="ruotaBanner()>
    [img]defaultig.jpg[/img]
    </body>
    </html>
    l'ho buttato giù così, nn so se funge...

  10. #10
    purtroppo no...
    per prova: www.bestwallpapers.info !
    grazie cmq...hai altre idee?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.