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

|
网页之奇特的文字变化特效
脚本说明:
( g& H* G& C4 r/ P6 i. M! \ 6 E0 X, K7 p; ]* M
第一步:把如下代码加入<body>区域中
+ {. ?# l7 P* U! R, m: l( c <script language="JavaScript">
4 E2 i4 k1 G& j5 M( u8 k! G
7 U2 \9 {& `- t$ Afunction nextSize(i,incMethod,textLength)
/ H$ t8 c8 z) y% B: ^{
% ^2 w" W& g A& U1 D: ?if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );+ O# \" V+ C( w& p+ X
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
, A4 [* j) |! {. k+ c" i}
% r$ w0 A% O( z
2 x v+ k2 Y7 j! u$ c( kfunction sizeCycle(text,method,dis)1 z& X3 I7 h9 c
{
J" m6 H/ W2 U output = "";! r# M5 U* e$ X% j6 n
for (i = 0; i < text.length; i++)
. `( r" u. l# e {
. f; r' k5 g: i. M" l; B9 { size = parseInt(nextSize(i +dis,method,text.length));, o8 T4 _( D; P! f, e3 B/ c
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
/ I$ ]9 L3 n) r }
$ J# d" e A! M0 G theDiv.innerHTML = output;3 T" T+ V# F% p, R+ g5 @
}
# B% h! C& k- a' n* {1 o' U, Y5 P4 K0 t0 K
function doWave(n)
7 `' c0 q) r( [4 ]{
1 z7 K; G0 ~/ U( K4 m theText = "JavaScript";
! i/ j: B# y& Q sizeCycle(theText,1,n);
, f- g+ N$ A. c1 ~9 e% ] {! _+ n7 r if (n > theText.length) {n=0}+ ?+ i6 F: V9 Y. F2 {5 D
setTimeout("doWave(" + (n+1) + ")", 50);& O% m% n9 a0 A0 H
}0 Y% u- @; Z/ X( E4 E) v- }
</script>" R- J1 E% W- I4 J2 G! Q7 o
<div ID="theDiv" align="center">1 f7 M3 X& S; b, H. X
# ~! K9 a* D. k; [9 i2 x1 q2 K</div>9 f( \1 I) B8 c5 b% \0 N; {
& \" q) N2 ?& O/ K! W5 Y
1 Y! d. v, ^' |+ A. m
; w, j; ^9 l& ^0 I; M& b0 H
& O! R6 _* Y! x1 q第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|