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

|
网页之奇特的文字变化特效
脚本说明:
' G* E& J/ w" J5 t* U0 ~$ g1 D
7 E3 a, S9 U a! K( S* i/ W& V' M" B第一步:把如下代码加入<body>区域中
# \8 n$ t+ p" t% X+ @+ k0 C1 I0 ? <script language="JavaScript">( o s! x/ W( [/ m5 V$ W
8 g/ {5 d O! J3 c$ ofunction nextSize(i,incMethod,textLength)
# M. E5 x1 S0 F" Z" j0 a' x{3 K( v/ o& [1 C$ @8 |* H# P
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );, q0 U8 e' i1 i: T- q
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
3 p' Q1 k% D( x5 H$ P/ ]7 @}
& i/ f, m5 g+ m$ o' @% ?; v% @# ^' J$ G% A" d2 |; P; S& Q. \
function sizeCycle(text,method,dis)
$ I2 B) b8 V# w{8 L4 X/ A% I5 }6 L( Y
output = "";
0 h2 a1 n8 [4 L" ]1 K. g6 u for (i = 0; i < text.length; i++)
: }$ R/ ~5 A z: x% w) b {- G& L! R4 E, F; M, g7 Y
size = parseInt(nextSize(i +dis,method,text.length));
- i8 J& j4 c2 q5 c output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";% P2 L9 O( d9 h1 u# s% O
}
, i* u3 [! a) ?* | theDiv.innerHTML = output;& d8 X _$ ~# x7 R# S; j
}
& g, w2 A4 U! |8 O+ ?! R$ N& v5 y7 U1 l6 c
function doWave(n)
6 B& Y3 v- C/ a3 x4 R{ ! N% ]. m6 R V* J9 R2 m
theText = "JavaScript";
; q2 _2 y/ e5 b$ j7 l4 B, u: ? sizeCycle(theText,1,n);
; W, V& a1 D: y& @& P if (n > theText.length) {n=0}
7 Z- q5 b( M6 e6 o1 i setTimeout("doWave(" + (n+1) + ")", 50);/ p9 C* y8 s5 W- j% _: Y6 V
}
& \( B2 k: f5 [' J% `6 b</script>
2 X8 J7 y5 F% w# U- ~; ]9 x) _" ]1 l' O<div ID="theDiv" align="center">
3 t9 C+ f6 W( g! F: j
* F V' T8 w R% t9 p# i( Q! c</div>
. S( P- l. |3 p9 M* u" p" Z n- S0 R5 f0 I1 m
, E1 a; L9 {1 z4 ~: l! K/ x
1 P4 U1 [( `( o1 ?7 O; T
/ Q/ e: N# V* R/ t9 i, s第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|