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

|
网页之奇特的文字变化特效
脚本说明: , F& U* q: |! ]( P5 O: [6 ]
8 B7 I+ b% g" p, ?第一步:把如下代码加入<body>区域中
) l' P8 E+ \0 O5 @3 a q9 }+ E <script language="JavaScript">) S! K) ], k! d a$ ~
+ o" O% l$ Q& X% c+ W
function nextSize(i,incMethod,textLength)- y: C& a7 ^( l: F8 P; w
{- `7 R3 r3 V9 r3 Y) p
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );. f( R0 T4 _! s" _: E' p
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));+ O+ f4 q0 r% s$ B5 {
}
3 p! ]( M1 N/ L% P" `2 L8 I K- J' U4 t2 P( z" J' F. [+ R7 d% b
function sizeCycle(text,method,dis)" h0 E W. y4 N. m- x" p
{
/ A% F1 Z+ U$ c. U6 W: V output = "";
) W0 _# ]2 w: e6 f$ Z for (i = 0; i < text.length; i++). V( n V9 u! S
{7 V5 w: k+ Q$ E! m) D, v: ~, t% c; X
size = parseInt(nextSize(i +dis,method,text.length));
! z- s* Q+ c+ C output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
, [( m1 @/ n9 v- t+ ?9 x: v }
2 O/ I' T3 _& J3 `9 ^$ b+ T theDiv.innerHTML = output;, n' r- X3 \% }3 Z" w
}
6 [: r' j7 T4 U1 N% l' a. F& n
5 _! G' c9 M5 U) ^! ffunction doWave(n)
; X N7 f- e0 B6 b% q6 w: F1 k{ + M. l2 v8 E: M, ^8 {
theText = "JavaScript";
4 a3 ~2 U" `- f sizeCycle(theText,1,n);
; ~" u! Z' n/ {$ Z if (n > theText.length) {n=0}+ h; B+ V1 S! f, l; H
setTimeout("doWave(" + (n+1) + ")", 50);
) b+ {" u O9 _& P}& ?$ \- }! a$ ^& h4 W
</script>8 O" Z+ D; ~' N$ b8 P
<div ID="theDiv" align="center">
3 S8 b$ N0 o: X& k3 q. v8 ]" m/ |9 w5 u0 y/ `
</div>
6 t5 ^# y! E1 G8 i2 C: X# h2 r/ Y
9 m: r3 c0 j$ b' ~# F3 O3 ^. O- L* H4 F- p% R/ B
0 Y, M( R$ W% `! g( n( }: s
. z% |+ L! u" I3 u$ I
第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|