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

|
网页之奇特的文字变化特效
脚本说明:
: u8 P. N; ]* P2 ?4 {! W 0 s! n+ w2 c% \
第一步:把如下代码加入<body>区域中1 z7 i0 E$ t* h8 G6 J6 G
<script language="JavaScript">! `3 w9 W k: E, y. [6 L
+ L$ z2 B, w9 b9 P( T/ C7 ?3 x4 R2 R! Ffunction nextSize(i,incMethod,textLength)* i: `+ e) G& S0 B
{
' V& b( }' {2 j) zif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );9 g- t) Z3 b0 t& H7 H
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));/ t7 S4 ^1 o F$ n: _
}
3 V" |. r5 Z. }% T: z4 z2 Q4 _ L
) i1 M3 h1 d$ \+ o6 c0 y# Qfunction sizeCycle(text,method,dis); G/ J, P5 t7 e; e0 d# D
{9 i5 X3 `+ h u
output = "";
, }' |% H4 H8 G+ Y3 x- i- q6 N4 \ for (i = 0; i < text.length; i++)
8 B7 O( S8 t2 x5 K8 \ {
: J7 f4 L( S, v$ z size = parseInt(nextSize(i +dis,method,text.length)); y6 Q. Q4 x1 o0 i( _
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
# _" M3 w _0 K$ N( H' k7 Y }
4 W! V* | l4 @8 C9 F; z, F) E- A theDiv.innerHTML = output;) W8 I6 r2 ?3 V0 X; w
}
8 H, J5 e+ d( U: W
4 c' E4 y/ D! Vfunction doWave(n)
, {( t( e1 O e% t{ ( J4 m5 B9 i% {6 e! Z
theText = "JavaScript";+ X5 E8 D+ I7 Y, R
sizeCycle(theText,1,n);/ b- j! Z: d3 ~3 L) K
if (n > theText.length) {n=0}
% r# g3 V+ A- F setTimeout("doWave(" + (n+1) + ")", 50);
& M# f# c: V. M9 f& @}# C3 {0 {' ^' A+ \% p$ C1 \" ~
</script>
! s; p4 |8 p# L: Q& y h. q<div ID="theDiv" align="center">; S9 a' ]% d/ Y0 B( L
& H$ z0 F S2 e" x3 X
</div>( B& W! k; V3 ^. |5 Q( \! t# E; {3 d
4 Z: a- y" X, B% n: x5 W. u& O9 V" ~4 r8 K; S' `3 p
2 s# I5 I, X; Q* @: ^0 L7 h. a ( f) K+ M {8 c! `' p( L6 ?
第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|