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

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

脚本说明:
, B3 R3 s1 `; t: e. A % b' f. {( S! b4 Q( {& X2 _+ G: o6 T
第一步:把如下代码加入<body>区域中
) z" ]  t% b  R) V <script language="JavaScript">& [1 \  b  s/ F8 [

4 U3 H2 K4 R& B3 O$ U  j; _: Q# Hfunction nextSize(i,incMethod,textLength)
# T) e; C( ~6 r{5 s! W) h" n; d3 e/ U) g6 @
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
+ K: P! E$ y  r  K+ @/ s, p4 i, dif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));9 |% q) S! q, f: o$ O
}
" Z: C8 e& e9 w& Y# c9 I6 i4 H, \2 J
function sizeCycle(text,method,dis)- ^+ d: z9 r/ r" d
{
7 n6 s' q1 m5 i. X        output = "";, i# P8 u' \7 D9 C: Y
        for (i = 0; i < text.length; i++)
: R- j4 N% r3 J  O) s' q# D* Q        {
3 m0 Z4 S) b! e) F7 A! a8 m9 t% Q                size = parseInt(nextSize(i +dis,method,text.length));8 s2 @) g# _. n; I  f0 @+ x+ N
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";% u, x. f, [5 T9 B
        }: x/ Q* I* ?* `0 e& Z% e" M
        theDiv.innerHTML = output;$ q) P# l2 I; W
}
$ @9 T- C  c8 P# w  T1 c/ c
5 U, L; v( d( Y7 M% r6 ofunction doWave(n)
3 M: {0 Y- e) Z% X; U5 H* o{     F( m0 [! H' _1 ~; x
        theText = "JavaScript";
9 z: B- _$ ?$ |5 ~        sizeCycle(theText,1,n);
  l! l3 l' p" G% t3 U- b" C' e7 i        if (n > theText.length) {n=0}% c9 s# V8 j9 ?& n5 I7 T
        setTimeout("doWave(" + (n+1) + ")", 50);
0 `' G( r' n# `. |$ P# j- |}
% `7 K8 |; v$ H" I' u/ q' u</script>
& ?) V& d, ~6 X$ l<div ID="theDiv" align="center"># Z( j' [6 ?; K+ a. U6 {& m

+ M  c( {( n. l0 N# p! f3 Q</div>. }0 o7 g# ]$ F. K* V* b9 U2 T+ ^- O  h
: n( |8 H; ~9 e+ v8 l" a$ R

4 \- \2 P1 e! e0 z! Q* o/ R# \' f0 P; L7 v# [: l% P4 c
( Y- i; z) |. C& j
第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

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