參考別人的程式改了一下(紅色部分改成自己的圖片網址):
<!-- Randomize header background image -->
<script type="text/javascript">
var banner= new Array()
//background image
banner[0]="http://URL/bg1.jpg"
banner[1]="http://URL/bg2.jpg"
banner[2]="http://URL/bg3.jpg"
var random=Math.round( (banner.length-1) * Math.random());
document.write("<style>");
document.write("#header {");
document.write(' background:url("' + banner[random] + '") no-repeat left top;');
document.write(" }");
document.write("</style>");
</script>
Freeyasoul Adventure: Random Rotating Banner Hack
沒有留言:
張貼留言