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

|
网页之奇特的文字变化特效
脚本说明: ; t: \) {8 e4 k+ }$ j @
/ Z% s8 b; e: u$ ~" D
第一步:把如下代码加入<body>区域中
) b l/ c* A2 Y* @ <script language="JavaScript">
% u: g" b: n+ U J0 m! D+ A" [' Z! h
function nextSize(i,incMethod,textLength)
; K) o6 e0 Z. e8 ~7 S{
6 [' D8 q& {: z& k& l6 Xif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );3 `& L* @$ ?) J7 _" U
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));( [7 S3 M. N. N0 v# h
}
2 ?5 w2 x+ `, O* S; ^8 F3 I5 O+ ]5 U2 ]/ Y9 x4 B/ u
function sizeCycle(text,method,dis); e" T+ X" V U3 h; r3 r
{' o% B5 Q1 @5 \5 T. c
output = "";- w! {; C% t! n! N% L7 e
for (i = 0; i < text.length; i++)
- U+ f" ^ Z5 D# Q {
7 O2 j2 V# z* h size = parseInt(nextSize(i +dis,method,text.length));
9 i: e8 d/ D! V5 ~ { output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
# d' |' `1 ~6 b- [9 l7 y }' ]0 f* M, s D7 p# o" B* G
theDiv.innerHTML = output;' f. Z( ~: w0 n3 q c
}8 K5 w8 g$ X, G
% v6 t! Y1 V0 o4 U; }5 Efunction doWave(n)
# |& |9 {2 g- I T6 @{
( E2 C9 U+ `# b theText = "JavaScript";
) \6 ~. D6 b8 Z# Y sizeCycle(theText,1,n);
/ w. E2 s6 I6 ]/ B if (n > theText.length) {n=0}! \. C* A, v1 }& b
setTimeout("doWave(" + (n+1) + ")", 50);
# r$ r. p" d% N; u5 h}- s. W6 w9 s [: W6 B( [( z! J) I
</script>
4 |" ?' k& `! C' u" ^- @, v<div ID="theDiv" align="center">
: B+ s' r- w( d: u0 }; J
+ f9 N& H8 I% T3 W</div>
$ d% h. X) a. [1 M- y, c2 d9 V0 r* {9 l" \. i* E+ z. Y7 ?
7 F) C- {' m3 F& Y0 @' Q7 `: g
/ c5 y* `6 s- n& x9 ^2 G; a
8 O2 O/ H; e ]第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|