  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之奇特的文字变化特效
脚本说明:
/ Q$ M6 z3 k: f. Q! [9 U
) x8 [+ H% q5 e7 S第一步:把如下代码加入<body>区域中+ y. ?3 F2 Q" P' w* ~& u
<script language="JavaScript">
! y) M# X; d* U0 G6 g8 `4 f! W4 X; m. W* x2 ^& R, \7 z
function nextSize(i,incMethod,textLength)
# j) ~; \5 m8 Q" r8 T{) e: U9 J. d: o
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );% x1 Q! g* a8 T+ ?
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));1 l/ p* H7 l Q, H M
}
" d* @4 R% q$ X3 i. W$ \- V* }8 k* O; t" F7 V Y$ B3 \2 w( t4 A* v& K; d
function sizeCycle(text,method,dis)
9 m4 Q& _1 |0 p4 o- q- C{% _- g* Q9 F% {: [1 m
output = "";
* B& X! G2 F4 m1 R for (i = 0; i < text.length; i++)
( p+ A, V5 {, z, o9 Z1 o {" O& I) L; x0 e
size = parseInt(nextSize(i +dis,method,text.length));
; J6 c! p1 X3 }+ F output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
& k1 W# i. ^* E* y }1 M" u% D3 z9 d8 k6 E7 _
theDiv.innerHTML = output;4 I6 ?. Y/ C4 h0 L9 O0 e
}+ y @9 X5 a$ ]# V- O
+ z8 A- e; X2 |& l/ P; M/ O
function doWave(n) " h" d% t& E7 W5 _/ W) A
{ 0 x1 W/ e9 }7 z; n# T& I
theText = "JavaScript";; ~: R2 k0 n9 C5 P
sizeCycle(theText,1,n);
4 E% d; a2 Y( n0 ^% c+ | if (n > theText.length) {n=0}
U. @1 e+ J/ ?* e! [ setTimeout("doWave(" + (n+1) + ")", 50);6 G1 o, E' ~9 T" b4 ^% M3 X
}
, Z: |1 T2 @4 \3 t+ T! A</script>! Y' o; ^$ b) X/ K1 I2 I. E3 l
<div ID="theDiv" align="center">
; B8 i# @, S: s& p# J9 X
# ~$ h. U8 ^$ C4 W, B( Y</div>! e" e8 P" E9 i3 l/ w! s2 s$ z
5 K2 T3 h; i' R' {5 A
$ `$ ^+ y9 E1 Z1 L- W
; E x+ I3 n5 G9 B6 |3 _
4 N$ V6 S6 y! ]* R; |7 |第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|