当前位置: 首页 > 图文教程 > 网络编程 > Javascript > JavaScript网页制作特殊效果用随机数

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 JavaScript网页制作特殊效果用随机数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 84 ::
收藏到网摘: n/a

网络世界精彩无比,绚丽的页面如果合理的使用特效,一定会增色不少。下面就是我总结的特效:
  跳动文字
  想看会跳舞的文字?来吧!
  代码:先在〈head〉和〈/head〉之间添加〈script language="JavaScript"〉
  〈!--
  function font11()
  //定义函数font11()
  {
  document.all.a1.style.fontSize=16+
  Math.floor(Math.random()*24); //调用Math.random()函数产生一个随机数,再利用Math.floor()函数产生小于或等于Math.random()*24的下一个数,来改变文字大小
  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调色)
  timer=setTimeout('font11()',200); //每200毫秒调用一次font11()函数
  }
  ---〉〈/script〉
  再在〈body〉中加onLoad="font11();"
  最后在需要处加上〈span id="a1"〉飞〈/span〉
  特点:文字颜色及大小可随机的变化。
  延伸:可在网页中添加多组代码,其中font11