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

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

脚本说明:
( P1 X* _5 ~6 x& b  Y3 _; Z$ n 9 Y+ k1 ?; \' b
第一步:把如下代码加入<body>区域中5 n- L5 @% q2 B7 v: n
<script language="JavaScript">
  q$ y1 c2 Y4 ^$ a! |/ o' q6 J3 j3 J) |& u
function nextSize(i,incMethod,textLength)" b% x# k4 m, J! T- V2 [* ~/ I
{+ D# }/ s) d' e/ Q3 o3 l1 K
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );1 o1 \7 G9 \# B/ T7 |" c2 e" B
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));9 m5 c! d2 a" l+ D  f5 u
}
+ s/ S! o. O" L' |' H4 w/ {, i
) D, b* z8 ]3 ]$ j, G4 Jfunction sizeCycle(text,method,dis)
* E' f8 L8 I5 U{4 Y' b+ t9 F! [% d
        output = "";
& g8 R& h8 A; A        for (i = 0; i < text.length; i++)1 ~2 B( F! v% M  i  ?6 M: B* |
        {, h$ j! P2 |. l5 D# p
                size = parseInt(nextSize(i +dis,method,text.length));/ H6 ]4 X  I2 g  f1 J2 I
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";$ O, ]9 a6 E& Q# I# m
        }
0 R% q' K3 c7 }5 u. j* Q3 [1 j        theDiv.innerHTML = output;
6 M9 E) Z/ a( k. W" [- x}3 F2 I- M% C* A9 g4 B8 `
3 _" ]+ m- {8 i/ _, ~6 T
function doWave(n) 8 j( a9 d# ^2 D; V! V7 r6 a
{   
6 _' T1 d# c8 S% M+ e        theText = "JavaScript";6 w$ I4 O) L2 C7 |: N
        sizeCycle(theText,1,n);
+ S; @( Y( T: j, R: M        if (n > theText.length) {n=0}
6 M2 m) ], i, F6 P* _0 v9 A4 e        setTimeout("doWave(" + (n+1) + ")", 50);
; G& M( s2 h* s) o5 B5 P7 H! \! s4 ?}
1 Q9 p; {) l/ O: C</script>; c, w5 e  C& e- A3 I  ~
<div ID="theDiv" align="center"># f1 Z* }2 C- [3 v/ H
+ a) H9 E7 k, I9 {% q9 g
</div>* T9 C3 k" f. A- a; j! C

. r/ N. _, D+ i8 H0 V) i' F9 W% s; D, T' o
3 V. u* z: j4 |) V$ o
% X2 H4 ~! X4 M$ i6 J
第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

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