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

|
网页之奇特的文字变化特效
脚本说明:
. P4 Q4 L2 h& r, D# ~ & ^/ r& V) x5 I4 a8 b0 X9 L4 L
第一步:把如下代码加入<body>区域中
, t& x8 i# J. w# {" v8 z <script language="JavaScript">! @( x; h) e9 @$ D/ ?( u, B% v
1 m8 J$ f/ O8 j# }" Ifunction nextSize(i,incMethod,textLength)
% l+ E0 s; o% b1 D{; u) n s( w1 A& o/ z' D% n
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );( g0 f& Q) M L4 ^( c
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));% p. \' d$ y- M6 h# f( _
}7 c+ g2 u( `7 m" K" ~
. T4 }7 u G- ifunction sizeCycle(text,method,dis)
! S* o" h3 s% P. n* N [+ ?% f{$ o# W1 s1 R! d' G2 o! o8 s( G/ _, h
output = "";
+ m4 O: t' q! H5 j) b2 ~ for (i = 0; i < text.length; i++)
2 w8 i, H5 d( Q! A) Q/ T1 o2 U {: m4 s' t. v/ M: f2 P0 n# z
size = parseInt(nextSize(i +dis,method,text.length));
4 G; K! J! }6 @% H output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
$ _: |0 Z7 `& P: ]7 |- U }2 h6 z& a* A6 m
theDiv.innerHTML = output;
8 X, `4 ?" a. x i* `( P}" L0 ^0 L* R+ R+ V( L( u, e
0 z+ B/ N- M' Y/ Z3 V
function doWave(n) 1 ?" k5 D8 I2 Q+ f7 ]) X6 q8 A
{
7 a" f' }7 K( g& P% P n1 n theText = "JavaScript";: V6 A" K7 F( E$ l2 D
sizeCycle(theText,1,n);* O2 h% V2 q8 ]2 Y% l
if (n > theText.length) {n=0}
8 x) {4 V; |2 w; T: l0 z3 Y; M setTimeout("doWave(" + (n+1) + ")", 50);, G) e9 _2 z. o" ~5 l
}+ I. X+ M) C6 R& U; U
</script>
5 L4 Z! a" Z `: V. F<div ID="theDiv" align="center">) b0 Q" ?6 h. w9 j
$ `" f2 B( I: [( G3 D0 Z* ~
</div>5 D8 K# h3 x6 B4 N4 s% u
- d4 `: O+ k, R7 V7 J/ i3 y: P
* @/ g5 f( b4 f+ B6 @6 l. O
/ [1 {2 B2 a* Q/ \8 i1 u; F/ D6 z 4 W7 }+ L. y% F0 y' D, z/ V/ q
第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|