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

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

脚本说明:
8 y2 y9 z5 g( F' U5 c4 l
6 A9 m. q) v8 E/ ~( _+ u第一步:把如下代码加入<body>区域中
. M' |1 q) E3 M  z <script language="JavaScript">
( s0 M3 X/ }& a; C; }& Y
/ L* I2 R* B, j1 X# Qfunction nextSize(i,incMethod,textLength)8 S+ X0 S# \: P/ S* o3 I* U
{
: V0 Y! V7 G8 c( O3 y' |6 Gif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
; I! V, @, {, z7 b2 Uif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));3 a/ f/ K/ }) Z. [! }* f3 D$ o) s4 n1 t
}5 d4 g5 t! O( O. \% x! P+ X
' v  q( |5 l1 d/ U
function sizeCycle(text,method,dis)
- u1 b' b7 t; m7 f6 s{
" Y- j: ^  [, B1 Y        output = "";; E6 j3 m# n4 u
        for (i = 0; i < text.length; i++)  \0 _# t, V' c: r8 S/ H- p
        {% O0 Y$ T6 P3 _8 X6 H
                size = parseInt(nextSize(i +dis,method,text.length));6 c' [  ?( c1 P* @, z" W; w9 d9 k' ^
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";6 f2 V/ h2 G* L
        }
$ W' d* X& Q+ s5 Z        theDiv.innerHTML = output;" k/ D* Q2 X  `: Z
}
! ^9 a( T9 Z) y+ `  @6 j
. e- c; n) |+ A3 Qfunction doWave(n)
9 r4 e! f/ K- e{   
& m$ G" @' I, l" M- k/ `: I        theText = "JavaScript";
1 z  d  q+ C7 B! I# Q4 R1 \( Q8 |        sizeCycle(theText,1,n);
' Q) v5 K/ I' ~/ s* y: f        if (n > theText.length) {n=0}
" L0 T' x- g& ^6 h, d" B- r        setTimeout("doWave(" + (n+1) + ")", 50);: a7 G; P& I, d- q1 S. Q
}
! C0 w$ o: V& U% C8 v8 G$ h0 d4 D</script>
9 A8 h1 Y" P) f% |, ~- C0 d0 u+ D0 {<div ID="theDiv" align="center">, x  x0 `" h' M4 K; _

1 _3 u/ {+ b1 J% M* Q</div>* F) \7 |9 p5 `: S" g

1 ~4 m: F( u2 n: T: T. q/ Y7 T# w/ j9 u1 ]5 w; ]" ^; ?- [
& i4 I/ h& a# X0 x

$ b0 Y& K8 t( @' K' P9 o% J第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

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