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

|
网页之奇特的文字变化特效
脚本说明: 2 x8 {/ @* @. _( f) K, W& q
2 e* A3 F* ^3 U0 n- ]6 a! m第一步:把如下代码加入<body>区域中' F3 q; Q9 t1 e, X0 H
<script language="JavaScript">
! t4 U9 L! O' Y7 K' p, [
& j$ r% d6 W r }6 l* rfunction nextSize(i,incMethod,textLength)* C5 ?% G# }" T1 b, {5 S8 T
{
) ^1 r/ l O6 c' {# K. a! I# }if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
2 z/ C7 O( M j& G+ vif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));( x& c$ B+ c4 c7 E1 A
}7 T; Z5 b( w8 B2 L8 @/ k3 I
! F* C+ J; \ `$ M- lfunction sizeCycle(text,method,dis)
5 |1 p! t4 Y( l" n, v$ m$ S) k{
! ^' H! y$ k4 Y4 ^3 o* f4 b output = "";
* |- o3 a1 q L$ v0 H7 _- n3 | for (i = 0; i < text.length; i++)
+ f* T- D: R R6 \7 h! U {
$ k( n4 w3 m: N% r' F! S( A size = parseInt(nextSize(i +dis,method,text.length));% H" b9 Z" M. X i( M. G* ]6 I# M
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
; m" c' p Z i* t/ R2 H4 H }2 B& F( q" |% m
theDiv.innerHTML = output;1 n3 P! I& i% J* `+ z. P+ g
}3 m/ V) r/ c, |, b& }
* ~% w# \0 [6 Y; I4 f! rfunction doWave(n)
8 b' Y6 h, }( i8 P3 Q. a1 J4 m{ 6 [! h. X" G2 ~. ~: L
theText = "JavaScript";
! F! k( V, ]; s A1 ?3 b sizeCycle(theText,1,n); ]4 {5 K: E' y& y3 n8 C
if (n > theText.length) {n=0}, ]' ~+ i( e3 n5 y) A
setTimeout("doWave(" + (n+1) + ")", 50);
: ]$ T, B+ Z4 ]}
" H, q, l; I$ m3 _" ]</script>
c# t7 [7 h+ {0 Q3 B- g. s/ p<div ID="theDiv" align="center">; M" I' d" Q. _/ b/ A0 l3 J* O1 s
8 J( ]8 z( } N+ q' B1 `
</div>' }' { ]# I1 `# [0 m; f; a! f
' y) R5 ?3 t8 d! v! q/ R: o( A6 Q3 r4 B1 U, g: H
3 N) b; C& C! U
3 q% F: Y, s8 ], x9 a第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|