一進畫面隨機寫入圖片語法
用於部落格上方刊頭、或變化語法後應用

語法如下:
<script Language="JavaScript"> image = new Array(3); link = new Array(3); image[0] = '圖片網址' image[1] = '圖片網址' image[2] = '圖片網址' image[3] = '圖片網址' index = Math.floor(Math.random() * image.length); document.write('<img src="'+image[index]+'" border=0 />'); </script>

插入至欲出現的位置即可
另包架構+css輔助使用美化定位

範例為 4 張圖隨機出現
若要增加或減少,改動的地方為:
Array(3)

增加或減少序列:
image[3] = '圖片網址'

序列數字由 0 起始,所以 4 張圖請設定 Array 為 3,序列為 0. 1. 2. 3
依此類推,5 張就設定 Array 為 4,序列範例:
image[0] = '圖片網址'
image[1] = '圖片網址'
image[2] = '圖片網址'
image[3] = '圖片網址'
image[4] = '圖片網址'


(完)
文章標籤
全站熱搜
創作者介紹
創作者 Leah 的頭像
Leah

Leah's Life

Leah 發表在 痞客邦 留言(2) 人氣(1,276)