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

|
网页之奇特的文字变化特效
脚本说明:
% V4 C5 y2 k, W0 D- S+ w
$ W* {( k; n, ^ h2 N; J1 P第一步:把如下代码加入<body>区域中
: Z( q1 W4 W m Z, l2 Z" I <script language="JavaScript">
7 ?8 Z1 A+ g z4 f! i$ N" M! J0 N7 S) g
function nextSize(i,incMethod,textLength)" E* n3 u: i% x5 C* q7 o6 F4 ?& n
{
/ e* N* s6 y2 Y4 H; z+ \/ Zif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );2 s) d7 ~8 j% R1 N0 s( w
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
f' p+ H$ A. F- Z0 }3 ~- u}
+ _) h3 V0 {5 g+ z, P3 W5 \5 C! @
# W7 ^. o1 q/ g l5 mfunction sizeCycle(text,method,dis)
9 K& t* ^/ L: |% j4 a{
4 W4 l1 v, { b! }: L+ J9 r output = "";
# |# r- W1 H N6 v, x7 X% ? for (i = 0; i < text.length; i++)
V% S, d0 D4 P) q {
) L+ L, C4 ~( W& X size = parseInt(nextSize(i +dis,method,text.length));
& b" B$ V5 P! {/ i output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";) d8 |0 R' P, N
}
; X0 o) e& { @. u$ ~8 u7 R2 u theDiv.innerHTML = output;
+ A4 N" d% ^( |}
0 r& s5 a7 c6 e' q$ _' H2 U& g( T& n; P) |- M4 n# g* L: s0 o/ x+ W# |8 [
function doWave(n) ! r/ S. k: |+ p$ q5 I$ q
{ c) j* T3 B/ J! U2 ]4 e* z3 D
theText = "JavaScript";
; l: ~; k5 A/ { sizeCycle(theText,1,n);( d: h' `9 H. o7 }4 u/ [
if (n > theText.length) {n=0}
% f7 b* ^( y3 |9 G6 p. t2 w setTimeout("doWave(" + (n+1) + ")", 50);
@0 K, \/ L0 V) I# G}5 w( _5 \0 {( _: ~% I( X
</script>2 o( h3 s( h* z
<div ID="theDiv" align="center">( n' ~# S1 o' ]
# F+ H, x& P0 z</div>
+ b% O! ^/ n( C6 R% y' G
* h* b6 z8 ]8 G! J8 E2 p0 P) p( ~) D/ Q2 p! `: d
( Y+ |, O* v5 W2 R$ ^6 q. s' c: s
; ^6 p- L, U+ f/ x. x5 N4 h4 c第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|