获得本站免费赞助空间请点这里
返回列表 发帖

网页之奇特的文字变化特效

脚本说明:
  n% d) i! m  J
5 `5 H. Q; i1 K0 H3 H第一步:把如下代码加入<body>区域中
. k# f% L9 q$ N+ H! A  V <script language="JavaScript">
" w3 ~, t  a3 `& `" T$ O. F
/ O/ C+ q! X/ ?9 H, Nfunction nextSize(i,incMethod,textLength)
+ m! A. D2 j" p  y) a' j( d/ u{
& ~( w1 Q6 B- U% u. W2 Y; Wif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
3 ^  G: N1 n% L) Eif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
* x8 B) [$ ^' c. t}
1 m4 f% F% U, I$ U6 y& R
  P- d( F; ]" R7 G( F* D& e; wfunction sizeCycle(text,method,dis)4 B8 D8 Z* l1 o# A, P8 }& x
{
5 d6 A( X! }% V) q0 {8 t3 s. W        output = "";
) X, I! P$ f) d" w2 r3 j( k7 j        for (i = 0; i < text.length; i++)
+ d7 E& \, t. Q        {
8 q" p: E' z( T6 W+ s, Z                size = parseInt(nextSize(i +dis,method,text.length));/ }  O7 ~' p/ @* A2 R
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";9 V" T6 ~8 v0 x8 d
        }9 G% Q2 e2 I) f' X- O/ v& H
        theDiv.innerHTML = output;7 ?! a# `& I; W# h1 m% f
}
/ `# q; b+ _8 G7 f: q: g& Q$ B7 x" ~5 D4 l
function doWave(n)
5 g/ P! ?9 p( |2 l{   4 N7 y$ ?7 b% t  }8 i
        theText = "JavaScript";/ f/ b$ N; ^% d+ [; x
        sizeCycle(theText,1,n);+ Q0 S5 G, q" G* A% S
        if (n > theText.length) {n=0}% U8 p- G& ~+ _2 f2 p6 B. L
        setTimeout("doWave(" + (n+1) + ")", 50);4 G( z1 k  @, O% ?6 h' C4 N  {
}
& x( ~& B- z% _! D9 g0 k4 ?7 W</script>' S! D# B* p. r
<div ID="theDiv" align="center">
# X8 ^3 @8 d- ^3 H! {' j7 k7 h7 W0 {! g7 b8 B5 {" i7 b
</div>
3 a, _, @* m8 o1 Q
( g- i6 r8 h, r+ K; f: ^
9 G+ K+ U* W* ~8 D% ?$ u9 Q* s# g/ }9 A/ Z2 e1 }7 ~0 Y: Z

7 S6 i- J4 p5 X$ O) G5 P第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

返回列表
【捌玖网络】已经运行: