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

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

脚本说明:
8 H; ?- u; W2 q7 I) _ " H  A) U3 |! n0 P% n! C7 h
第一步:把如下代码加入<body>区域中8 P1 r7 M% W$ z" U& J
<script language="JavaScript">9 S. m+ q" K$ ]/ o

; R. G, m7 b; X! ?6 ^1 F( tfunction nextSize(i,incMethod,textLength)
: V- d& u- b0 L- j{
, b, U" g4 O" P7 S3 Eif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
' X6 E! ~: w& \! r/ e7 v( [4 T) iif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));) ?% c: }8 _4 ?, j- U
}* u) ~* l- U: l) k. a: k1 c

: v; u) v$ w5 e" [0 vfunction sizeCycle(text,method,dis)6 d0 q0 S( t; b/ ^5 B* S6 z
{
/ [# j+ V2 |& d" p        output = "";
8 c3 P6 C# ]- c: A% E5 \8 L' f* }        for (i = 0; i < text.length; i++)
' k* A7 }! R+ A* z2 ~        {
& _3 X& u" |9 }' O) {                size = parseInt(nextSize(i +dis,method,text.length));8 \% I/ N! K5 x. V4 J
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";* e+ n. J# o! M! N
        }$ X2 i2 Q- T* h* J9 @8 L* p- Y
        theDiv.innerHTML = output;# u7 f% E' ]7 g2 Q5 Q  P) ~+ g
}5 g. w" S1 ]8 u- A2 ^9 l
6 F5 u) A" B1 g# T8 d
function doWave(n) 8 D" `9 o, n1 N! R1 V6 A2 m6 Z
{   
/ ~  `, ?$ {- P: a7 ]2 L) }) o0 B        theText = "JavaScript";4 X$ Y' A* F6 ]5 l, l3 b
        sizeCycle(theText,1,n);
3 F* a3 C9 }0 J0 R$ t/ ^        if (n > theText.length) {n=0}
  H0 A7 b: a7 q7 U/ Y        setTimeout("doWave(" + (n+1) + ")", 50);
- Y% u! N6 p2 W; q7 ^}
* l  b' B( n3 d* X& Q3 X' i</script>- w% Q" l8 N# j
<div ID="theDiv" align="center">
+ Q3 m1 W* ~' x/ I! Z) m* G' G2 G
</div>8 X, q' R2 C% _' y
& |' P" {7 c# U, H# H

- S: v( g6 z) i5 _# U
8 e4 a' @$ h0 R ( h: y1 v, ^/ ~3 B
第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

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