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

Javascript
Add a Table to a Word Document
Add Formatted Text to a Word Document
用jscript实现新建word文档
用jscript实现新建和保存一个word文档
Open and Print a Word Document
Use Word to Search for Files
Convert Seconds To Hours
Sample script that deletes a SQL Server database
Sample script that displays all of the users in a given SQL Server DB
firefox中用javascript实现鼠标位置的定位
div+css实现鼠标放上去,背景跟图片都会变化。
Locate a File Using a File Open Dialog Box
Save a File Using a File Save Dialog Box
用jscript实现列出安装的软件列表
List the Stored Procedures in a SQL Server database
Display SQL Server Login Mode
Display SQL Server Version Information
List all the Databases on a SQL Server
用jscript启动sqlserver
Stop SQL Server

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 89 ::
收藏到网摘: 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