欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JavaScript網(wǎng)頁制作特殊效果用隨機(jī)數(shù)

 更新時間:2007年05月22日 00:00:00   作者:  
網(wǎng)絡(luò)世界精彩無比,絢麗的頁面如果合理的使用特效,一定會增色不少。下面就是我總結(jié)的特效:
  跳動文字
  想看會跳舞的文字?來吧!
  代碼:先在〈head〉和〈/head〉之間添加〈script language="JavaScript"〉
  〈!--
  function font11()
  //定義函數(shù)font11()
  {
  document.all.a1.style.fontSize=16+
  Math.floor(Math.random()*24); //調(diào)用Math.random()函數(shù)產(chǎn)生一個隨機(jī)數(shù),再利用Math.floor()函數(shù)產(chǎn)生小于或等于Math.random()*24的下一個數(shù),來改變文字大小
  c1=Math.floor(Math.random()*256);
  c2=Math.floor(Math.random()*256);
  c3=Math.floor(Math.random()*256);
  document.all.a1.style.color="rgb("+c1+","+c2+","+c3+")"; //同上,改變文字顏色(利用RGB調(diào)色)
  timer=setTimeout('font11()',200); //每200毫秒調(diào)用一次font11()函數(shù)
  }
  ---〉〈/script〉
  再在〈body〉中加onLoad="font11();"
  最后在需要處加上〈span id="a1"〉飛〈/span〉
  特點:文字顏色及大小可隨機(jī)的變化。
  延伸:可在網(wǎng)頁中添加多組代碼,其中font11 分別代表不同的文字,今后是font12 、font13 等等,文字可表現(xiàn)為每個都不同。
  圖片淡入淡出
  隨著時間的過去,圖片也循環(huán)的由模糊到清晰改變。
  代碼:先在〈head〉和〈/head〉之間添加〈script language="JavaScript"〉
  〈!--
  mark=0;
  function tupian() //建立函數(shù)tupian()
  {
  if(photo.filters.alpha.opacity〈10)
  //當(dāng)圖片透明度小于10時
  mark=1;
  if(photo.filters.alpha.opacity〉98)
  //當(dāng)圖片透明度大于98時
  mark=-1;
  step=2*mark;
  photo.filters.alpha.opacity+=step;
  //透明值計數(shù)器累加
  setTimeout('tupian()',20);
  //每隔20毫秒程序執(zhí)行一次
  }
  ---〉〈/script〉
  再在圖片屬性中加id="photo"和style="filter:alpha(opacity=0;)"
  最后在那個圖片代碼的后面加上〈script〉〈!--
  tupian();
  ---〉〈/script〉
  特點:圖片循環(huán)淡入淡出。
  本文的代碼都非常簡單,需要解釋的地方我都有解釋。

相關(guān)文章

最新評論