✔ 最佳答案
你可以先加入以下的 function:
function randomBG() {
var bgArray = new Array("a.jpg","b.jpg","c.jpg")
//先設定一陣列bgArray,括號裏面打番背景圖片的名稱,每個用引號引住,用逗號分隔
var i = Math.floor(Math.random() * 3)
//設定一個隨機亂數i,注意 Math.random() * 後面的數字是圖片總數
document.body.background = bgArray[i]
//設定背景為bgArray 陣列中的第 i 項
}
然後在 body onLoad="randomBG()" 即成
範例:
http://rapidshare.com/files/46316444/Template.zip.html
2007-08-01 20:20:09 補充:
若要加在 Xanga,先到 Edit - Look and Feel找到 Website Stats (在最底) ,在下面打番:script (前有 但我不打因為會 Show 唔到後面D 野)var bgArray = new Array("a.jpg","b.jpg","c.jpg")var i = Math.floor(Math.random() * 3)document.body.background = bgArray[i] /script
2007-08-01 20:24:25 補充:
Blogger:右上角customize, 再按 Edit HTML, 就可以自己插入javascript.
2007-08-01 20:41:20 補充:
But Wordpress does not allow user to add Javascripts, so the above is not practical.See what Wordpress says:
http://faq.wordpress.com/2006/05/07/javascript-can-i-use-that-on-my-blog/Sorry for that