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

|
网页之奇特的文字变化特效
脚本说明: + o; {! m5 ~; V) G3 }
+ B- |1 [+ P5 e; P$ U$ v# ]# S+ [第一步:把如下代码加入<body>区域中3 ~" x$ Q/ u. I a8 j/ k
<script language="JavaScript">
. r& P" g: Q8 Y; w: N7 O- ]: j8 O. r% W: [/ t3 n, e! [& `
function nextSize(i,incMethod,textLength)3 }& @6 ~6 Y3 a# K. t
{
) T9 h' d8 M" H# r1 }' R" A% Pif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
9 R( P- n$ f" e3 ?" y- S, Cif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));( o' _5 h$ a9 w! |4 I6 r) M+ ? c
}& @6 ]& m6 s$ k `) t6 V# [
% `! Q" }6 k" _( i
function sizeCycle(text,method,dis): K4 {9 R$ U# Y' @
{
: }2 M3 n% j) Y) U output = "";% C' @) E9 _* N$ v% Q* v
for (i = 0; i < text.length; i++) O: h# T0 x8 G, ]2 Y( e
{
. N2 p3 m" V( B& T* F, c8 d9 t size = parseInt(nextSize(i +dis,method,text.length));: R) d+ o1 {! N) d
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
; D. ?9 `* d) T# @- R# v }- c) `8 M9 T8 c1 U& G' e
theDiv.innerHTML = output;
. V/ U; g; e; q! l; Y}0 P$ @) c+ [* D# l. s( j) N
" K% U9 p7 d" Nfunction doWave(n) ! h7 W& z7 p* U) u F; Z2 `' q
{ , `' i8 E- E1 n- d8 _4 u- b+ I" g2 V
theText = "JavaScript";
- [2 f! [) _9 u f# F9 H sizeCycle(theText,1,n);
1 s! g! \( e1 }' f3 T if (n > theText.length) {n=0}
' l8 l- D$ v' S setTimeout("doWave(" + (n+1) + ")", 50);
- Y& I5 \3 i4 S- N4 L4 H: Z}
; s) z6 f1 D% c; ]; T</script>
8 }: l& i5 y! r @% g<div ID="theDiv" align="center">
/ c1 L0 [# o2 R7 w4 T
4 I% J# r( n% v# }9 @</div>) @5 h) t* `& `/ p7 ` }( Q
6 G$ s, z9 S& [% `8 i
. Y: c% R# K- O" Y: V- F' s2 N
. l! P* M5 m. Z* [ / H1 x% ^" H8 z+ \. i" f
第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|