JavaScript- Random Image Script Generator

Refresh a few times for a demo.

Selects a image url at random. Image width, height and a couple 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.comroadrun
1999 - 2024    Made in the U.S.A