  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之奇特的文字变化特效
脚本说明:
' o, h/ p! W6 w$ A
3 `6 K) t9 G7 T y M第一步:把如下代码加入<body>区域中. s3 }% e8 d1 {7 ?
<script language="JavaScript">2 J5 l( m: A9 C2 X' h
" K4 ]0 I: O# I2 A$ i* C0 P8 t
function nextSize(i,incMethod,textLength)# {- n! n/ u( J2 V3 v. u
{% P( V: F) Z$ C
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );; ^' F3 t. ? |& p, K2 o
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
$ l/ Y3 e0 l. v6 J! D3 M4 {- Y! A}: X+ D; Q' A1 \( n7 x$ ?
# ?# z" U7 H+ @# w* x8 O |function sizeCycle(text,method,dis)
' y; L6 B( i1 ~% r- i{
4 f% a3 r5 D% _, J1 D. D output = "";
J% V/ M4 p" e# a- w for (i = 0; i < text.length; i++)
$ }% C0 L( f. o: O, x( E3 K {+ D y* ~8 X9 ~9 K8 v B/ p
size = parseInt(nextSize(i +dis,method,text.length));; ]# S' _. ` Q' ?9 E
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
: V; |6 i, d; O& G: G* {. S }: x" G. n1 B% t7 W* T5 Y( o
theDiv.innerHTML = output;8 z7 | h: M: \ g
}
" B; B% [; S# l) N+ N+ ~ W: q8 [- f) u7 [) O
function doWave(n)
# g& O7 `; E! V{ * {3 q) G" i0 _, [8 `3 B' s% l
theText = "JavaScript";
" Z- R5 u7 s7 D; E8 o8 |3 M4 O& y sizeCycle(theText,1,n);6 _* @: Q6 R$ P* P) l. {
if (n > theText.length) {n=0}
7 n) f- V( f6 K% S3 ? setTimeout("doWave(" + (n+1) + ")", 50);
' i0 U, b* e# n: e$ W& d# F} ^% d! Q3 j8 L- F" u8 G( C* V
</script>) C+ S. U& \% A8 x
<div ID="theDiv" align="center">) p9 f6 f" g( w D
: q6 O( u1 m% c0 N3 m P
</div>% U8 _) @/ |- ~
- X& E2 _: x- D& c
4 i( R- f+ F* R' [$ w: g" ~
5 t( E4 Q, @; ^3 `6 A
7 q) a; g% Y# } A7 q0 }' N第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|