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

|
网页之奇特的文字变化特效
脚本说明: ) {' a. C# I$ c5 X/ g7 K: U% z/ h- Z% ?
' ~* C) M& F2 ~2 _0 p第一步:把如下代码加入<body>区域中1 I9 {3 H2 {! z) @
<script language="JavaScript"> V6 q' p1 w: i; o
: \! U! a- a4 {0 Z1 H
function nextSize(i,incMethod,textLength)
. j( U8 s) K/ m i8 G! ~9 ^{! D- z0 D7 u( j' Q
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );* p- }: w5 | p' N
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));: \0 L- q6 S0 p, o
}
) ]6 g* |8 ~3 l( d. v0 `& e- d* T: f6 D5 V0 H/ t7 A; E
function sizeCycle(text,method,dis)
, p2 p n) o% a' X1 `{
9 i# g% F+ Z; ]8 H( I! s output = "";
0 s( d; Z8 ~" a0 Q& b3 F# Y for (i = 0; i < text.length; i++)
8 p, K0 }) f5 a8 _" } M. K {
8 J- V2 o$ A5 M size = parseInt(nextSize(i +dis,method,text.length));
! B: m. c0 [1 {# A output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";8 D+ j* P5 n4 J$ X; ]" E
}
# b* o' D. F) z: @, s& Y+ ~ theDiv.innerHTML = output;, D# I3 F5 N7 o+ w' d+ _. \* Q
}7 h% j. S X' n& F; a1 l/ }
, L. n) x# k) O2 i k0 n
function doWave(n) & F% Z1 E$ I3 c- \- H
{ * k) E) o& t+ Q6 ]# \2 e& A- ^
theText = "JavaScript";
4 R# t0 Z# G2 h) O sizeCycle(theText,1,n);/ l2 m! Y+ Q+ \
if (n > theText.length) {n=0}
' H+ l/ [' ?* | W" q, Y setTimeout("doWave(" + (n+1) + ")", 50);: O7 v) o2 ~1 U. k2 p! \
}( ?, G: T: y* g# } u
</script># d% L/ u. A3 w8 U
<div ID="theDiv" align="center">
4 a' |* }1 E- {1 s3 E
" W( F0 T1 f9 D" w/ w</div>* D: I! A4 b* U) q+ Z
+ c$ P& R5 P: {4 q. Q, S9 g9 F; n& w) t, n
k5 W' A/ a9 J7 }
2 H( I8 ^% @# C, G! g第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|