How to show a random piece of graphic on every load of a page.|
TAGS: random, graphic, webpage, HTML, PHP
This small example can be used for example in your header, showing a random banner every time a new page is loaded. Or a piece of graphic anywhere on your page.
Here I make use of five graphics. You should rename you graphics 'banner1.png', 'banner2.png', ... etc.
As you see the number/name of the banner is 1-5 and is simply inserted between 'banner' and '.png'
This is a small stand-in for a slideshow, that may be what your are really needing, if you need effects or the images to come in a specific order. Notice that because this is randomly, you may see the same graphic come twice, nothing in any order, and it may not even show image number 3 the first 10 times..