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

|
网页之奇特的文字变化特效
脚本说明:
- X: h9 ~5 N4 L5 E. j ) ^( m+ ?4 t, |8 t
第一步:把如下代码加入<body>区域中, E$ j/ V& o/ j+ L$ ?3 w5 U
<script language="JavaScript">, J$ K6 p7 G- i+ Z; [! ?
5 N( j* K$ A# Z. {- l
function nextSize(i,incMethod,textLength)
9 B/ d; x z8 n5 e d+ i. p{' E: e* x/ N( g$ Z7 }
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );( `; I b" P5 z: i1 D# ?
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
: I9 t" z% g) b3 g3 w}- @( [# e8 a' G' c- B' j. l
+ ~- P5 ~. o: R" p- a% v, q
function sizeCycle(text,method,dis)
8 W" X6 I! m1 V ?" ~; j# t% x{
r. t5 ]! x! e' v output = "";
2 A8 h) N* b8 ^8 }1 R1 _4 ` for (i = 0; i < text.length; i++)$ ~. x- T! Z& G/ V
{# x1 E, r- W0 ^2 g, l7 t
size = parseInt(nextSize(i +dis,method,text.length));& ]9 G) N4 g' z$ J K$ b- i
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";0 _! o- V# Y. f- ]7 i' t1 w
}
; \% r0 t* t1 o1 f8 o: n# m theDiv.innerHTML = output;
4 J6 S% @0 y) v/ d8 M}& D( h$ R0 j& a
2 `6 t1 g |# S1 i0 h2 t1 jfunction doWave(n) . F* Y) n) [' {0 D
{ / N2 Y1 X. B& V0 I5 O
theText = "JavaScript";
I& P0 J5 p/ I$ J. S' O sizeCycle(theText,1,n);
3 i, ]; [# W0 a( C& p7 _ if (n > theText.length) {n=0}% }; ] r4 C6 g. S* n' H" j
setTimeout("doWave(" + (n+1) + ")", 50);
; b3 m" T7 X5 C( q- o) S! O}
! ]2 E% e: h! W7 \& i4 L$ M' f* d Y</script>1 A' `( I+ T J
<div ID="theDiv" align="center">
' @1 x- \( Z- M5 I9 h. p! P- E# r4 G0 Y: U! R
</div>
- n7 W; D0 v4 g' v1 ]$ ^7 ?# g6 U
$ ~ Y0 O3 u1 t2 [, |( d
- S/ z, L4 V e q' G
5 ]+ p+ _9 k& x+ S* Z) G$ ?' s
第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|