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

|
网页之奇特的文字变化特效
脚本说明: - u6 A+ C) x3 U% g& v3 G4 f6 I1 h
& D" L( _2 |1 B, o
第一步:把如下代码加入<body>区域中1 i8 Y, z& [ y, @1 \. z- B$ M7 J
<script language="JavaScript">
, B2 W, O H! h( }% \+ H- s; [* E3 q3 ]+ e/ W, l$ K
function nextSize(i,incMethod,textLength)2 }& h ]6 l# L
{6 A" P5 c( Q0 S* ?# `2 P4 p
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );) C* p' F" Y. t& D# v
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));5 @4 @2 h" ]' l: M U
}
+ {1 F, |0 b+ E( Z5 n+ G% Y( Z6 @5 y. Y( @ I, `% U) x
function sizeCycle(text,method,dis)
6 c* f) x3 `6 X- z7 M{: l P& N0 }4 ~& m3 h
output = "";
7 i) L/ b" s; |3 ^2 ?6 ^ for (i = 0; i < text.length; i++)' w% l' C, g& N4 M9 j8 N
{
8 i4 e( f; \9 {2 ~ size = parseInt(nextSize(i +dis,method,text.length));) d6 P \ X" d4 J# T6 D; q' I
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
% `: m: v8 G% T+ n( a4 S }, X, @' z/ y1 Z2 h, o6 `+ ~
theDiv.innerHTML = output;3 t5 ]% d" |8 ]9 B! T. v7 ~0 H. x
}) z0 d5 r# Z- Y% F8 ?1 R
7 k& b9 d( n& X
function doWave(n) 4 C- h7 p7 f0 J$ {6 f* F
{
' S& D% C, V0 [7 P- K" ^/ z( M theText = "JavaScript";% c0 p* x8 `$ d, S
sizeCycle(theText,1,n);
6 e/ f2 d4 j6 _! c; N4 k if (n > theText.length) {n=0}" ~2 ^8 b5 }0 W G" g; Z
setTimeout("doWave(" + (n+1) + ")", 50);" l5 _; g) f" d: D
}8 A! }0 `8 S2 @' T6 {
</script>
; m4 S) A- p/ Y9 G1 z( p" M<div ID="theDiv" align="center">
4 W9 @* J; T6 w; F" Y5 k/ z P! W$ [4 W# }! I+ I& t4 {
</div>
8 n0 i) _- v! l' n, O$ M! e3 W' k: w8 s
# E9 r1 n3 q6 h2 y: ]" [
4 |9 }( p0 ]- ~8 ?( j% \5 F: N7 Y( x% v
2 C2 ^8 h3 G" a) Y第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|