Announcement

Collapse
No announcement yet.

Anyone know Javascript?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Anyone know Javascript?

    Hey everyone,

    If anyone knows JS, any answer would be appreciated!

    I have two banners for my vBulletin community. I would like to make it to where every time a new page loads on the site for the user, one banner is chosen at random. I'd put the banner in my forum directory via CuteFTP.

    Could anyone please tell me the coding that would allow me to do this? Any help is truly appreciated.

    Thanks.

  • #2
    By the way, there is no forum for JS, so I wanted to ask here.

    Comment


    • #3
      Must it be JavaScript or can it be php?

      (javascript may be posted in the html forum )
      That's the end of that!

      Comment


      • #4
        I'm using a php one I made, on my board... I'm not sure if there is any js ones out there. You might want have a look at hotscripts.com or even do a search on google.com.
        Chamber of Secrets - The Ultimate Harry Potter Community!

        Comment


        • #5
          Probably get better replies in the HTML questions forum

          Half the people that come here, know Javascripting though
          MCSE, MVP, CCIE
          Microsoft Beta Team

          Comment


          • #6
            I'm just using a custom PHP code in the phpinclude's start template.

            Something like:
            Code:
            $randomvar = round(rnd(0,1));
            if($randomvar == 1) {
            	//do stuff
            } else {
            	//do other stuff
            }
            :)

            Comment


            • #7
              Why not get phpads and call it in an iframe?
              Running vB since 4-14-2002

              Comment


              • #8
                Code:
                <script language="JavaScript"><!--
                
                images = new Array(2);
                
                images[0] = "<a href='http://domain1.com'><img src='http://domain1.com/banner.gif' alt='Visit domain1.com'></a>";
                
                images[1] = "<a href='http://domain2.com'><img src='http://domain2.com/banner.gif' alt='domain2.com'></a>";
                
                index = Math.floor(Math.random() * images.length);
                
                document.write(images[index]);
                
                // --></script>

                Comment


                • #9
                  Originally posted by Rapid Gaming
                  Code:
                  <script language="JavaScript"><!--
                  
                  images = new Array(2);
                  
                  images[0] = "<a href='http://domain1.com'><img src='http://domain1.com/banner.gif' alt='Visit domain1.com'></a>";
                  
                  images[1] = "<a href='http://domain2.com'><img src='http://domain2.com/banner.gif' alt='domain2.com'></a>";
                  
                  index = Math.floor(Math.random() * images.length);
                  
                  document.write(images[index]);
                  
                  // --></script>

                  I don't know what to replace with this code. Here are the two links to the banners that I want to use:

                  http://www.ducknation.net/forum/imag...onfootball.jpg
                  http://www.ducknation.net/forum/imag...basketball.jpg

                  Would you be able to make the necessary modifications to your code with the links I provided? I'm not sure what to do. Also, can you tell me exactly where this is supposed to go and what I need to take out and replace it with this code?

                  Thanks.

                  Comment


                  • #10
                    Look here:

                    Code:
                    images[0] = "<a href='http://domain1.com'><img src='http://domain1.com/banner.gif' alt='Visit domain1.com'></a>";
                    
                    images[1] = "<a href='http://domain2.com'><img src='http://domain2.com/banner.gif' alt='domain2.com'></a>";
                    ...simply change the html there (all you need to do is change a few urls).

                    Comment

                    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                    Working...
                    X