文档介绍:教学项目二十三 JavaScript文字特效网页设计
【基本内容】
讲解JavaScript中几种文字特效网页设计
【教学要求】
学会设计文字的特效
一、案例设计:
设计文字绕圈旋转特效网页
程序代码如下:
<html>
<body background="">
<SCRIPT LANGUAGE="JavaScript">
if () {
yourLogo = "湖北职业技术学院计科系学生网";
logoFont = "隶书";
 logoColor = "00b000";
yourLogo = ('');
L = ;
TrigSplit = 360 / L;
Sz = new Array()
logoWidth = 180;
logoHeight = -30;
ypos = 0;
xpos = 0;
step = ;
currStep = 0;
('<div id="outer" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < L; i++) {
('<div id="ie" style="position:absolute;top:0px;left:0px;'
+'width:20px;height:20px;font-family:'+logoFont+';font-size:40px;'
+'color:'+logoColor+';text-align:center">'+yourLogo[i]+'</div>');
}
('</div></div>');
function Mouse() {
ypos = ;
xpos = - 5;
}
=Mouse;
function animateLogo() {
= ;
for (i = 0; i < L; i++) {
ie[i]. = ypos + logoHeight * (currStep + i * TrigSplit * / 180);
ie[i]. = xpos + logoWidth * (currStep + i * TrigSplit * / 180);
Sz[i] = ie[i]. - ypos;
if (Sz[i] < 5) Sz[i] = 5;
ie[i]. = Sz[i]* ;
}
urrStep -= step;
setTimeout('animateLogo()', 20); }
= animateLogo; }
</script></body></html>
案例二、设计文字的变色特效网页
程序代码如下:
<html>
<body>
<script language=javascript>
<!--
function initArray() {
= ;
for (var i = 0; i < ; i++) {
this[i] = [i];
}
}
var ctext = "看看我,我会变色";
var speed = 1000;
var x = 0;
var color = new initArray(
"red",
"blue",
"green",
"black",
"yellow",
"pink");
if (("MSIE") != -1)
{
('<div id="c"><center>'+ctext+'</center></div>');
}
function chcolor()
{
if (("MSIE") != -1)
{
.