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

|
网页之奇特的文字变化特效
脚本说明:
; `8 p( Z) y8 E ) F8 G4 e4 v0 n8 @: w% [
第一步:把如下代码加入<body>区域中
# k V& j: l% v0 C <script language="JavaScript">
: t0 a7 x- K) N) y) j6 E
) e% t: C% [4 f tfunction nextSize(i,incMethod,textLength)# K" |7 \* Z$ x" X3 L
{ `4 M, z" q0 U5 @) a0 D
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
# ^5 _% m! ]! L; w" O" E4 `if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
. s$ O A0 Y/ F# J: i _% m8 t}
- @4 u/ ?3 u1 Z1 r( x: p
4 F3 f$ p0 ^7 v. }function sizeCycle(text,method,dis)1 @, t+ l9 \+ V3 w% j# t. D' B
{
0 i1 M! f1 e9 I+ ^* y: M output = "";6 S8 p) t' H! E* b( m
for (i = 0; i < text.length; i++)
: ]. O$ z, ?% y$ a {$ b! Q6 D/ l/ U2 z. p9 \
size = parseInt(nextSize(i +dis,method,text.length));- Q* e# U$ Y5 Z
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
% f* @& T) {' S" W. ~; Y; c: @ }8 V' c' p+ v8 f3 T
theDiv.innerHTML = output;
. U; j* X2 I* s3 B- U6 ~+ _}& m8 T) ?% o# y% [) S5 \6 D
9 p& c0 Q6 W. B" _# b' m- U# _
function doWave(n)
( H* |$ x; \* N( Q8 P{ 0 e. g {2 \. i5 `( j+ }2 F
theText = "JavaScript";) d% ^+ A k9 I G
sizeCycle(theText,1,n);+ |: v/ S( d0 f- H3 A
if (n > theText.length) {n=0}
) i y. e1 H3 o) s( c setTimeout("doWave(" + (n+1) + ")", 50);0 C( K4 n3 ^* M# r% ~* x
}
/ D/ E& T. |+ i4 l8 }+ q! ]</script>! v2 l( p: L j& a! H
<div ID="theDiv" align="center">
8 ~ u# t7 D4 D. r
. K1 \8 U9 C6 b7 v* h</div>' v$ e, C& p% @* m. t; ]0 ~
9 y7 o4 c9 W6 U( | ~
7 b" Q& k/ n! Q7 A) n, R- @! v- R6 O1 Y& ]2 \ w. l
6 j( |1 y; D+ ~4 J第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|