How can i make a banner for a website?

How do you make a banner on a website change every time the page is refreshed?

  • Where can I get the code for it? Thanks!

  • Answer:

    This is an easy one todo, But there are also a few methods depending on security or end results... I'l show you a quick javascript code for a random selector <img src="blank.gif" id="imgOutput" /> <script language="JavaScript"> imgSrc = new Array(4); imgTitle = new Array(4); imgSrc[0] = "BannerOne.gif"; imgSrc[1] = "Banner2.jpg"; imgSrc[2] = "Bnr3.png"; imgSrc[3] = "Banner4.jpg"; imgTitle[0] = "1"; imgTitle[1] = "2"; imgTitle[2] = "3"; imgTitle[3] = "4"; var imgSelected = Math.floor(Math.random() * imgSrc.length); var imgOutput = document.getElementById("imgOutput"); imgOutput.src = imgSrc[imgSelected]; imgOutput.title = imgTitle[imgSelected]; </script> The next one would be a PHP script... <img src="generatebanner.php" /> The generatebanner.php would simply output an image using GD and select it's soure based apon time/random/ or other factors.... this method of linking to a PHP script is VERY HANDY and SECURE... stops people hot linking.. If you would like any more help or anything, please feel free to contact me

Madison at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.