Rotating AD - Code for Widget and Forum Side Block

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • molieman
    Senior Member
    • Nov 2006
    • 171
    • 4.0.0

    [CMS] Rotating AD - Code for Widget and Forum Side Block

    My partner and I have been searching for this since Beta 1 and finally have it working. Perhaps this is or is not the place to put this info, but I thought it would be helpful.

    Rotating AD - Code for Widget and Forum Side Block, also works in the advertising blocks

    Use HTML Widget and Side Block, enter the below code in the Widget configuration and SideBlock Content:

    Code:
    			<HTML><HEAD>
    <TITLE>Rotating banners with links</TITLE>
    
    <script type="text/javascript"><!--
          //Javascript Created by Computerhope http://www.computerhope.com
          //store the quotations in arrays
          // images[0] would be image 	1, so 0 through 4 = Array(5)
          images = new Array(5);
    
    images[0] = "<div align='center'><a href='http://www.xxxx.com' target='_blank'><img src='http://wwwx/advertising/FSC/xxx-2.gif' border='0' alt='' /></a></div>";
    
    images[1] = "<div align='center'><a href='http://www.xxxxcom' target='_blank'><img src='http://www.xxxx.org/advertising/ACE/xxxxx.jpg' border='0' alt='' /></a></div>";
    
    images[2] = "<div align='center'><a href='http://www.xxxx.com' target='_blank'><img src='http://www.xxxx.org/advertising/Opencockpits/xxxxxx.jpg' border='0' alt='' /></a></div>";
    
    images[3] = "<div align='center'><a href='http://www.xxxx.com' target='_blank'><img src='http://www.xxxx.org/advertising/FSC/xxxxx.gif' border='0' alt='' /></a></div>";
    
    images[4] = "<div align='center'><a href='http://www.xxxx.co.uk' target='_blank'><img src='http://www.xxxx.org/advertising/SimVionics/xxxxx.jpg' border='0' alt='' /></a></div>";
    
    index = Math.floor(Math.random() * images.length);
    document.write(images[index]);
          //done
          // --></script>
    
    </BODY>
    </HTML>
    You can see this in action at www.mycockpit.org
  • kat00
    Senior Member
    • Dec 2006
    • 259
    • 4.0.0

    #2
    Looks good mate.
    I'm going to do something like that but timed rather than refesh. Well done.
    ttttt

    Comment

    • hamster0914
      Member
      • Jan 2006
      • 60
      • 3.8.x

      #3
      Please post the timed refresh code here if you get it running, I'd like somehting like that as well.

      Comment

      • ocyberbum
        New Member
        • Feb 2006
        • 3
        • 3.5.x

        #4
        Originally posted by molieman
        My partner and I have been searching for this since Beta 1 and finally have it working. Perhaps this is or is not the place to put this info, but I thought it would be helpful.

        Rotating AD - Code for Widget and Forum Side Block, also works in the advertising blocks

        Use HTML Widget and Side Block, enter the below code in the Widget configuration and SideBlock Content:

        Code:
                    <HTML><HEAD>
        <TITLE>Rotating banners with links</TITLE>
        
        <script type="text/javascript"><!--
              //Javascript Created by Computerhope http://www.computerhope.com
              //store the quotations in arrays
              // images[0] would be image     1, so 0 through 4 = Array(5)
              images = new Array(5);
        
        images[0] = "<div align='center'><a href='http://www.xxxx.com' target='_blank'><img src='http://wwwx/advertising/FSC/xxx-2.gif' border='0' alt='' /></a></div>";
        
        images[1] = "<div align='center'><a href='http://www.xxxxcom' target='_blank'><img src='http://www.xxxx.org/advertising/ACE/xxxxx.jpg' border='0' alt='' /></a></div>";
        
        images[2] = "<div align='center'><a href='http://www.xxxx.com' target='_blank'><img src='http://www.xxxx.org/advertising/Opencockpits/xxxxxx.jpg' border='0' alt='' /></a></div>";
        
        images[3] = "<div align='center'><a href='http://www.xxxx.com' target='_blank'><img src='http://www.xxxx.org/advertising/FSC/xxxxx.gif' border='0' alt='' /></a></div>";
        
        images[4] = "<div align='center'><a href='http://www.xxxx.co.uk' target='_blank'><img src='http://www.xxxx.org/advertising/SimVionics/xxxxx.jpg' border='0' alt='' /></a></div>";
        
        index = Math.floor(Math.random() * images.length);
        document.write(images[index]);
              //done
              // --></script>
        
        </BODY>
        </HTML>
        You can see this in action at www.mycockpit.org

        Just what i was looking for!! Thanks

        Comment

        • Bae
          Member
          • Oct 2009
          • 63
          • 3.8.x

          #5
          Molieman, do you mind posting your exact code so I can try it on my site. I am not able to get it to show up in VB 4.0 and also just a plain test page



          If you view my source you can see everything is there......... hmm....

          Comment

          • Bae
            Member
            • Oct 2009
            • 63
            • 3.8.x

            #6
            Just to clarify, the link i provided is a test page. You won't see anything which is the issue. But if you right click and view my source you will see your script there.

            Comment

            • syrus.xl
              Senior Member
              • Jun 2005
              • 546

              #7
              I am hoping to have a banner rotator released by tomorrow. However, it is built-in to a customized header which you can see a demo on http://www.shedevils-ld.com - this rotates banners or can randomize them.

              I will be releasing further rotators very soon, all on vbulletin.org.

              Comment

              • kat00
                Senior Member
                • Dec 2006
                • 259
                • 4.0.0

                #8
                Originally posted by Bae
                Molieman, do you mind posting your exact code so I can try it on my site. I am not able to get it to show up in VB 4.0 and also just a plain test page



                If you view my source you can see everything is there......... hmm....
                This is the code I used, hope it helps.

                <script type="text/javascript">
                var imgs5 = new Array("http://nswroadandtrackbikes.com/imag...ges/ozlogo.jpg");
                var lnks5 = new Array("http://rocketbikes.com.au/","http://...eleathers.com/");
                var alt5 = new Array("Rocket Bikes","Zeno","Doin Bikes","Wet4URacing","Oz Motorcycly Leathers");
                var currentAd5 = 0;
                var imgCt5 = 5;
                function cycle5() {
                if (currentAd5 == imgCt5) {
                currentAd5 = 0;
                }
                var banner5 = document.getElementById('adBanner5');
                var link5 = document.getElementById('adLink5');
                banner5.src=imgs5[currentAd5]
                banner5.alt=alt5[currentAd5]
                document.getElementById('adLink5').href=lnks5[currentAd5]
                currentAd5++;
                }
                window.setInterval("cycle5()",4000);
                </script>
                <a href=""http://rocketbikes.com.au/"" id="adLink5" target="_new">
                <img src="http://nswroadandtrackbikes.com/images/rblogo.jpg" id="adBanner5" border="0" width="215" height="90"></a>
                ttttt

                Comment

                • Bae
                  Member
                  • Oct 2009
                  • 63
                  • 3.8.x

                  #9
                  I don't know what happened but I gave it another shot. Instead of editing my current top banner I had in my advertising manager in the ACP I made a new one.
                  Then I changed the index and turned off the one I wasn't going to use.

                  The after I clicked saved it work!!!!!

                  It must be a cache issue or something. So Thank you to Molieman and his script. I would suggest that if anyone uses it that they create a "New" ad vs editing an existing one.

                  Here is my code:
                  <HTML><HEAD>
                  <TITLE>Rotating banners with links</TITLE>

                  <script type="text/javascript"><!--
                  //Javascript Created by Computerhope http://www.computerhope.com
                  //store the quotations in arrays
                  // images[0] would be image 1, so 0 through 4 = Array(5)
                  images = new Array(5);

                  images[0] = "<div align='center'><a href='http://www.partspitstop.com' target='_blank'><img src='http://wmriders.com/images/village_wmr.gif' border='0' alt='' /></a></div>";

                  images[1] = "<div align='center'><a href='http://www.macgyvercustoms.com/index.php' target='_blank'><img src='http://wmriders.com/images/macgyver_banner.jpg' border='0' alt='' /></a></div>";

                  images[2] = "<div align='center'><a href='http://www.soupysperformance.com/homepage.html' target='_blank'><img src='http://www.soupysperformance.com/i//SoupysPerformanceFinal.gif' border='0' alt='' /></a></div>";

                  images[3] = "<div align='center'><a href='http://www.xcaliburoffroad.com/' target='_blank'><img src='http://wmriders.com/images/webbanner2_xcaliber.gif' border='0' alt='' /></a></div>";

                  images[4] = "<div align='center'><a href='http://www.wmriders.com' target='_blank'><img src='http://wmriders.com/images/animated_logo.gif' border='0' alt='' /></a></div>";

                  index = Math.floor(Math.random() * images.length);
                  document.write(images[index]);
                  //done
                  // --></script>

                  </BODY>
                  </HTML>

                  Comment

                  Related Topics

                  Collapse

                  Working...