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

|
网页之奇特的文字变化特效
脚本说明:
8 }' t; f N; S! k" ?
# B m L; w: n; O/ X6 z" a第一步:把如下代码加入<body>区域中
& u* ?2 S h0 b/ U <script language="JavaScript">
4 p5 p+ C3 A7 x. _5 E& L/ l: p
( h) t5 s( W, w2 \7 ?& K- Ifunction nextSize(i,incMethod,textLength)
# n: X8 l7 A9 R: g, o, w/ l{ A2 `) q6 t2 U4 O- F0 [. I) l& `
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );7 ?, c( x, z0 }2 }# Y) u5 W& `+ g
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));. W* M* V6 O) P. O
}, W) a1 f! |9 o
* ]$ H7 Q; t4 d& h' k5 z! Y2 V
function sizeCycle(text,method,dis)
& c# v$ V# z7 E5 v7 M1 ^{
4 ~& [/ l4 C% A0 k output = "";
- \$ P6 B/ \8 I. o; ]4 m for (i = 0; i < text.length; i++)
1 |% d# w t1 _# ^1 s% a- O, `7 `: Q {
0 t9 M( d3 R. F5 ?7 T size = parseInt(nextSize(i +dis,method,text.length));
( H: y i( @" e- l output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
! X8 G; p* V* g; K }% r# q6 |# M- z$ ]% m; i6 c" l
theDiv.innerHTML = output;, q% j7 z2 ]8 m2 V4 s/ [# y6 h
}* n" T0 B$ o8 B' V5 m
$ ^, X, t* j* g& \% G, B2 Vfunction doWave(n) 6 S% y3 X/ G4 u; X: A' m( _, q3 B
{ * x: j/ t! R: s: h$ P9 l# N
theText = "JavaScript";6 L8 \. |3 i4 _) K4 ]
sizeCycle(theText,1,n);
$ q2 c. @# s7 n2 _. S if (n > theText.length) {n=0}
' F. c8 R4 G& _0 g4 K( h0 n" } setTimeout("doWave(" + (n+1) + ")", 50);. N8 U- U8 W6 u4 w
}% F8 t5 o9 L; @8 m F; C; S
</script>5 \. a* w& O7 }) V1 m: v
<div ID="theDiv" align="center">
5 G4 A& [, P/ Z- l* f4 x2 P' ^3 p3 ^
</div>
+ R# b, F; z4 @$ Q. J: U
+ N- b% B: i8 l$ H/ h2 S# W3 F, q1 c7 P$ z# X& M6 T
- |- N* o% q( {8 m, K! D" G
- ~" E/ d: `" F @第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|