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

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

脚本说明:
, A  f- y& j0 x) T: X4 P
* Y7 r) q% I- U( |/ K8 U6 |3 B8 y第一步:把如下代码加入<body>区域中- B! n5 p1 O3 i' _3 D1 n
<script language="JavaScript"># t# \1 h8 _  o  V! F% w( p5 y' J" ^; P3 _
( Q- z$ ^2 w5 i
function nextSize(i,incMethod,textLength)
0 u, F$ d; Q: m+ j' w{' p$ Z& X% h) l7 y/ F
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
5 F# F/ L/ e' y8 c. Vif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
6 ^( {6 T4 g) ^2 z}
8 e; g' P. ^9 C; [% @8 C4 ]4 q: v( ~) J$ v3 q
function sizeCycle(text,method,dis)
0 L1 N1 I0 i$ L{) g( D- f/ l6 C, T" ?2 U7 a; U. H: |/ F2 K. T
        output = "";
$ |  `/ h; ^& `0 g  A1 z/ F        for (i = 0; i < text.length; i++): }. a5 U' m- ^  B. b5 D5 k
        {
/ t5 {1 I6 |* z6 r                size = parseInt(nextSize(i +dis,method,text.length));
- V; w/ q3 X% ?* ~                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
$ i& Z- d+ P! o8 g        }
1 X8 ~7 {% T  {: Z. Z" f        theDiv.innerHTML = output;, j& e2 r  {5 i0 x; c( i7 I
}
$ u- U2 {" e' X) L- f# k! d! [0 I, l( q
function doWave(n) - H- @" z, |6 x8 G5 O, S2 S
{   
6 Z9 [/ z% J& s        theText = "JavaScript";; X, y: t" g/ @% D! y' Z
        sizeCycle(theText,1,n);
' B# [' s, d+ a- U        if (n > theText.length) {n=0}
; O0 P4 L0 d, K5 x$ v5 i7 x        setTimeout("doWave(" + (n+1) + ")", 50);
! U) _1 V% Q2 Q. |9 A4 }3 I}
' y) k3 |6 r4 }/ ]</script>! ]) v; G0 H( S9 K1 M/ }
<div ID="theDiv" align="center">
; ~9 o- U$ o" b; p- S' R, @% g1 F2 @' S0 y" C) w
</div>
1 {6 c0 o2 |) o: J# {' b0 W* k0 J1 I+ a

* a* C6 \4 x& s5 S1 O  F- D2 B: ~6 T) C9 p

8 o4 w7 a& ?  O% D8 F第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

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