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

|
网页之奇特的文字变化特效
脚本说明: - w1 a) P0 }, w$ n4 R: x, [( c( @; y
( g' \! f6 s$ I* G4 }! \, B% n第一步:把如下代码加入<body>区域中
% H) w p' @" i ]1 v <script language="JavaScript">
4 F% W( P: e" d0 [" w2 O6 t; r0 X3 g& O/ f2 E; `; x+ R
function nextSize(i,incMethod,textLength)3 r4 o+ a* O% i# k8 w
{
9 Y# g" `$ G; Jif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );8 F; O f% k s5 G- e: R- c
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));/ G* f% w1 m' S" l3 G
}( D; d+ p' k8 Y9 ^) f1 W- [
: m. ~( p1 W1 U) U9 {function sizeCycle(text,method,dis)9 ]8 g6 E/ `( s# K/ N
{
0 B* K" v' X, [! r% l output = "";6 I# d/ x4 F2 a5 Z2 B
for (i = 0; i < text.length; i++)$ |& c# ~* s) N* b. ?& Y
{: j+ \% Z0 s+ B) b4 p
size = parseInt(nextSize(i +dis,method,text.length)); @( E9 [2 L) u; k s3 Z
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
1 |4 O) ^& A( Y0 `% t, R }
0 X; Y4 S: O4 Z0 ?6 f+ D theDiv.innerHTML = output;; C3 a. ^' g! O ]: k! K, Y
}0 A+ q5 g: M" D4 a
, @1 I# z B0 T! x7 K _' g
function doWave(n)
+ X( ~0 ]7 V" q/ }% F4 H; m/ i- E{ ) q% S! \4 C' c1 G& @4 i1 J- w
theText = "JavaScript";# `: H2 W3 Z' d+ M% G
sizeCycle(theText,1,n);1 u# j |( V: |% K! P
if (n > theText.length) {n=0}
1 e0 @, b* p( ]: o setTimeout("doWave(" + (n+1) + ")", 50);# p1 o: v5 c1 E) l9 p6 Y
}
8 |: u1 d$ Q/ N {6 d</script>
, @; d* V% ]9 Z$ W7 m; t<div ID="theDiv" align="center">
- P# Z9 @* a) { T
1 C% E5 b, K/ o- S% G, w. y" k</div>) ]/ X# y& a$ W" r: d0 d
+ q, }; O9 c4 i" t k$ k* b; [8 a% J# Z% z5 L, r1 `
! D2 r5 u+ j; \* p
( ]8 Y% N) b( u$ z/ j" O p, m0 t第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|