Hello. I'm working on building a website and I've found several nice header backgrounds for my website "Explore the US". I would like to set up the page so that every time it loads, it randomly selects one of the backgrounds. How much code would be needed? I cant imagine that it would take more than a few lines.
I found what I needed here: http://www.tutorialstream.com/tutorials/phpmysql/random-image-perfect-for-header-or-ad-rotation/
I've been using this php script for a while now, seems to do the job just fine... http://photomatt.net/scripts/randomimage
<?php $bgr = rand(1,4); ?> <img src="http://www.mysite.com/background/<?php print $bgr; ?>.jpg"> PHP: Nice and simple to get you started.
It can also be done easily in PHP, This will rotate your banner and not randomly display one. To add more than 3 images just add more $Images[] = 'Banner4.xxx'; etc. Spoono.com
I agree - javascript is easiest, though you may also want to consider a banner rotator (ie a php script) if you wanted the headers to link to different pages on click
Javascript may be the easiest, but if you're like me, I usually 98% of the time have it disabled in my Firefox options.
.js disabled ? I hear this more and more. is there a php script to write some lines of html..? basically, I have a external js write about 10 lines of html, header, image and css menu link for SEO.. how can that be done with php..?