/ Published in: JavaScript
Alterar Background randomicamente.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> var banner= new Array() banner[0]="Image01URL" banner[1]="Image02URL" banner[2]="Image03URL" banner[3]="Image04URL" banner[4]="Image05URL" banner[5]="Image06URL" banner[6]="Image07URL" banner[7]="Image08URL" banner[8]="Image09URL" banner[9]="Image10URL" var random=Math.floor(10*Math.random()); document.write("<style>"); document.write("body {"); document.write(' background:url("' + banner[random] + '") no-repeat center top;'); document.write(" }"); document.write("</style>"); </script>