BACK HOME

JS - Random Image Script Generator

Refresh a few times for a demo.

Set up a list of images and randomly display them as inline images or background images. No Server Side Includes required - just point an IMG tag to the script. Perfect for rotating banners, advertisements, and artwork galleries.

Image width, height and a few urls are required.

width:  height:
Thats all folks!
copy to clipboard
<script>
// Add to the head of your document
pics=new Array("{{url1}}","{{url2}}","{{url3}}","{{url4}}","{{url5}}","{{url6}}","{{url7}}","{{url8}}","{{url9}}","{{url10}}","{{url11}}","{{url12}}","{{url13}}","{{url14}}","{{url15}}");
lnpics=pics.length-1;
index=Math.round(Math.random()*lnpics);
</script>

<!--- Add to the body of your document.-->
<script>
document.write("<img src="+pics[index]+" style='width:{{imgw}}px; height:{{imgh}}px;'>");
</script>
Riverdrift.com   
2003 - 2026 Hand Made in the U.S.A