获得本站免费赞助空间请点这里
返回列表 发帖

网页之奇特的文字变化特效

脚本说明: / q$ r0 i0 n1 _+ f
& P: L& p6 R. D
第一步:把如下代码加入<body>区域中
3 O- h, \; ^, a3 ~8 t( J& f3 @ <script language="JavaScript">
3 t! ?& R  y" a8 u& e1 R! j' K6 V6 K5 d  M3 h; I
function nextSize(i,incMethod,textLength)
: A8 f( T9 a5 f  T/ S  ]9 L{
& L0 `: w/ T% |( K. V- iif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );& h5 }" L$ n2 R
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));; \3 [5 n2 a, t* r2 ~. H8 }
}' L; z3 M. s( D  h( v  D0 z) _2 r1 j

6 x# h7 F1 s; F) Yfunction sizeCycle(text,method,dis)
- @) H  B& i0 b, I) T{" h& j: S) m7 v
        output = "";
5 j8 x, i- M& X, I" I        for (i = 0; i < text.length; i++)
4 Z3 n) j3 f) U3 X' I+ b" q        {9 A! e% }5 n% L$ b% c: e! L; x1 x
                size = parseInt(nextSize(i +dis,method,text.length));# X' f% W6 E1 \) `$ r
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";, @( t; x' Q2 @5 E6 M2 e
        }
- b3 }( E7 L0 h+ E" q7 |* h* a        theDiv.innerHTML = output;* c$ W9 z  t4 k2 P: R) D9 K
}' Z7 J% Y; T, L$ S- O* z5 }/ v( b

; y; ~3 A0 ^+ }  K: ~function doWave(n)
0 j  t( D$ c. C; O6 C8 j{   ' R! U. t+ V1 k/ H0 C! R* t
        theText = "JavaScript";2 W" {1 H" G% \4 f" [2 r8 N  U
        sizeCycle(theText,1,n);
2 N  V' U* @& k8 \        if (n > theText.length) {n=0}
+ U+ ~- W' p3 r7 R" L5 Z" z        setTimeout("doWave(" + (n+1) + ")", 50);
% i! {+ [0 F% t6 D0 m" o1 C& n}
' P5 \! |. [8 _3 x( Y& L1 L</script>
; ~2 @' B3 \& M/ g' p/ S<div ID="theDiv" align="center">% ?; i& m! }- R7 k

9 a- h- @. a1 R9 q: y</div>1 P* e9 t) A& p8 e' n
: Q" `/ I- E+ W9 R; k. ?

+ L, D, n8 t. S
, R) ~$ s8 j  K  A . ~; Q2 b  T6 j6 v# R+ G3 n. U
第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

返回列表
【捌玖网络】已经运行: