Guest Posted February 19, 2007 Share Posted February 19, 2007 I have a header which runs accross the top of my page. im interested to know that if i had a few versions of my header if i could get different headers to load at random when a page opens. So for example if you press refresh or view a different page on the site you would view a diferent version of the header. I've seen this sort of thing done within standard html. but have no idea how to do it myself. so i assume its achieveable in cubecart. Quote Link to comment Share on other sites More sharing options...
roban Posted February 19, 2007 Share Posted February 19, 2007 I've done this in index.php for another site but never tried on a CC site: <script language="JavaScript" type="text/javascript"> var theImages = new Array() theImages[0] = 'your image source' theImages[1] = 'your image source' theImages[2] = 'your image source' theImages[3] = 'your image source' var j = 0 var p = theImages.length; var preBuffer = new Array() for (i = 0; i > p; i++){ preBuffer = new Image() preBuffer.src = theImages } var whichImage = Math.round(Math.random()*(p-1)); function showImage(){ document.write('<img src="'+theImages[whichImage]+'" alt="header image">'); } </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.