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

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

脚本说明:
/ _) N- b; S: i: [- u& }: |
9 ~; O  ~: ^3 S6 S第一步:把如下代码加入<body>区域中
$ o, V% V* l- g9 ? <script language="JavaScript">; D0 Q  E! b5 N. `
9 r6 }" ]: E" \3 J( k
function nextSize(i,incMethod,textLength)( w; f6 n/ n5 W# E( d' O
{
/ S  x/ n& y4 z- g) [1 lif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
1 d# c8 X, p; z1 U: hif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
; N; q# f+ r  ]  F; v% \0 R}2 g) r$ Q8 l1 X

  f0 q9 c1 V% W  f' u* T! ffunction sizeCycle(text,method,dis)
  k% F8 K1 _$ N: f0 E{
: J# s" ], ?" I- M        output = "";
( D/ }; b" V7 y" P        for (i = 0; i < text.length; i++)
: ]# N* n: u# o" y        {
2 @' Z4 ~- H  N" T8 w                size = parseInt(nextSize(i +dis,method,text.length));. F6 C( o. \3 g# r6 a
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
/ ?3 D. C$ v) N1 o* f        }
4 {5 o: d/ ^7 s) l8 S- e        theDiv.innerHTML = output;4 n6 r2 Q; {# \9 a* M, C. i
}
, `8 v( B. b! o: C# W. [! z9 \
2 }; g) O1 w: B) k7 xfunction doWave(n) 4 p, i! t% t% n' L' Y
{     G8 n, B# S( Z# y: W
        theText = "JavaScript";3 r& d6 o; g+ R( c; z
        sizeCycle(theText,1,n);" H: H, Q( u2 ~% j: B2 T
        if (n > theText.length) {n=0}, f1 t+ c% X. _
        setTimeout("doWave(" + (n+1) + ")", 50);
3 Y7 ?& [; z1 v, Y# ^9 P}
; y: m# ?9 Q5 B3 @- p</script>
: t2 O/ a9 ^' f3 S1 L, |3 C<div ID="theDiv" align="center">
) R+ ?& g( y  c8 `. j8 B: f4 V7 z" F' D6 O/ p6 h2 j- j
</div>
8 _9 B2 H# h. ^: C: U
) g; V5 c( {, H' N  \6 e6 a; X/ Z$ K1 P% i
( r" {- ~$ x4 \
* o' |  m# I  k- V0 I$ J& b
第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

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