欧美激情网,国产欧美亚洲高清,欧美屁股xxxxx,欧美群妇大交群,欧美人与物ⅴideos另类,区二区三区在线 | 欧洲

知識學堂
  • ·聯(lián)系電話:+86.023-75585550
  • ·聯(lián)系傳真:+86.023-75585550
  • ·24小時手機:13896886023
  • ·QQ 咨 詢:361652718 513960520
當前位置 > 首頁 > 知識學堂 > 網(wǎng)站建設(shè)知識
實用技巧:隨機顯示不同頁面背景
更新時間:2012-01-24 | 發(fā)布人:本站 | 點擊率:284
<script>
s=new Array(3)
s[0]=Math.floor(Math.random()*256)+""
s[1]=Math.floor(Math.random()*256)+""
s[2]=Math.floor(Math.random()*256)+""
a=s[0]+s[1]+s[2]
document.write("<body bgcolor="+a+">")
document.write("</body>")
</script>

<script>
s="icon/icon"+Math.floor(Math.random()*18)+".gif"
document.write("<body background="+s+">")
document.write("</body>")
</script>

紅綠藍三種顏色:

<script>
s=new Array(3)
s[0]="ff0000"
s[1]="00ff00"
s[2]="0000ff"
i=Math.floor(Math.random()*3)
document.write("<body bgcolor="+s[i]+">")
document.write("</body>")
</script>

按鈕上:

<script>
s=new Array(3)
s[0]="ff0000"
s[1]="00ff00"
s[2]="0000ff"
i=Math.floor(Math.random()*3)
document.write("<input type='button' value='按鈕' style=background-color:"+s[i]+">")
</script>

隨機顯示圖片:
將以下代碼加在<head>與</head>之間。

<script LANGUAGE="JavaScript">
bg = new Array(3); //設(shè)定圖片數(shù)量2
bg[1] = 'icon/1.gif' //顯示的圖片路徑
bg[2] = 'icon/2.gif'
bg[3] = 'icon/3.gif'
index = Math.floor(Math.random()*bg.length);
document.write("<BODY BACKGROUND="+bg[index]+">");
</script>