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

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

脚本说明: . l# O# d" Y0 Y8 x& d' |8 v/ k
9 \, a- A  X% j5 [4 O- b4 T
第一步:把如下代码加入<body>区域中: M5 O9 U! Q$ n
<script language="JavaScript">
/ [: t+ z4 [4 L0 G: ~- M3 H+ k/ K
function nextSize(i,incMethod,textLength)
  Q$ I5 f0 p2 a1 O: A6 O{( J) H3 B; x# L6 G% U
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
" m6 \0 V( E( c. Cif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
4 l8 w/ ^0 X! ?1 z8 ?' ^5 f5 t}8 S3 v5 z1 t1 ]  h$ {
; C# ?# j( R2 s) c5 K
function sizeCycle(text,method,dis)
! [% }8 [- t6 S! Y{$ o/ q$ m) E7 D# Y7 A
        output = "";
: b; Z) R3 A3 y. Y2 b        for (i = 0; i < text.length; i++)
' N/ K( m# C* ~6 B7 a/ Z+ i        {
8 S' b7 C6 j7 o1 k5 I                size = parseInt(nextSize(i +dis,method,text.length));
2 X2 D0 f8 F* ^# B( Q                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
" g* w9 W8 A9 K6 f; c* O$ W        }3 W9 d# Q9 k4 a& f* ^
        theDiv.innerHTML = output;7 i$ Y( E) I! ?' l# |2 ]8 l
}6 Y5 o" |9 x/ k2 B

1 L5 ]  B/ W( Q7 L5 Ifunction doWave(n) 1 G( `) [( m5 b( s2 I# |% x
{   6 I2 S. P7 C% P5 E
        theText = "JavaScript";
  P' @2 g; @+ q) r$ R        sizeCycle(theText,1,n);
; Z+ h5 O  N  |        if (n > theText.length) {n=0}' ?  b- E$ M, t( X* K3 k
        setTimeout("doWave(" + (n+1) + ")", 50);4 U5 p1 k9 N* N# d" X; h
}
: ^1 w( J0 k! ]3 g) j5 R8 M% |</script>) L! I, d. `) t
<div ID="theDiv" align="center">. O* G( a9 F7 ?1 R, ?
7 Y+ L6 E2 Q, n1 T; b
</div>
  X4 n; q5 a% W( y% }' ?
/ W3 u% i" R" x7 |% D- z" C  d& c" H, A
; B0 T5 i1 V- i$ ^) O  Z5 M# d; T

* }( |0 Z( k4 n9 {. Y第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

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