Jump to content

CSS random picture?


Fusion

Recommended Posts

Hi all!I was wondering if CSS is able to do the random pic thing so that my web banner is different with every refresh.If not, which lang/script should I use?Thanks!
i dont know if css is able to do it, but javascript is. Script
<script language="JavaScript" type="text/javascript"> // This script was supplied free by Hypergurl // http://www.hypergurl.com <!-- // JavaScript to interpolate random images into a page. var ic = 6; // Number of alternative images var xoxo = new Array(ic); // Array to hold filenames xoxo[0] = "http://www.yoursite.com/graphic1.gif"; xoxo[1] = "http://www.yoursite.com/graphic2.gif"; xoxo[2] = "http://www.yoursite.com/graphic3.gif"; xoxo[3] = "http://www.yoursite.com/graphic4.gif"; xoxo[4] = "http://www.yoursite.com/graphic5.gif"; xoxo[5] = "http://www.yoursite.com/graphic6.gif"; function pickRandom(range) { if (Math.random) return Math.round(Math.random() * (range-1)); else { var now = new Date(); return (now.getTime() / 1000) % range; } } // Write out an IMG tag, using a randomly-chosen image name. var choice = pickRandom(ic); // --> </script>

Body code :

<script LANGUAGE="JavaScript">document.writeln('<TD'+'><IMG SRC="'+xoxo[choice]+'" HEIGHT=184 WIDTH=120 BORDER=0 ><'+'/TD>');</SCRIPT>

copyd from :http://www.hypergurl.com/randomimage.htmlNot sure thats what you want dident read so much but looks like the right thing :)->Kristian_C.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...