获得本站免费赞助空间请点这里
返回列表 发帖

网页之奇特的文字变化特效

脚本说明:
8 r5 U( `8 Y* `1 u* L * _# o4 n: R5 u- S" @
第一步:把如下代码加入<body>区域中! C0 m) i5 ^/ G9 @
<script language="JavaScript">
5 u+ P, P- c' ]6 d+ |6 }' N5 Y  }& R/ t9 q# T& b1 }8 D# m* |
function nextSize(i,incMethod,textLength)
( a# X( F& M8 ~" [" K{
- E, A0 k4 s% T3 wif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );: {& a# [# V3 _/ q8 i5 m$ X
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
' P& i4 v$ o( a5 \, S0 D/ `}4 Z. H$ p3 n. d$ f( [5 g8 P; p

9 q! f" A' P+ h7 P/ j. }  Mfunction sizeCycle(text,method,dis)
. C  x0 J4 Z& y# K/ ]! l{- Z9 C$ h3 Z- ^. P* l/ |. B- n
        output = "";! Z& Y5 n6 f; G1 r2 l! B
        for (i = 0; i < text.length; i++)
5 M. Y! t# h1 F# ]: a        {
- S/ U5 u- A% d                size = parseInt(nextSize(i +dis,method,text.length));1 H' S9 u# j( V
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";  u/ ^" g. }" U2 X0 c9 s
        }
( }: H  [4 A+ i  m6 L- T2 R        theDiv.innerHTML = output;
1 O* m' q7 }6 T. @; ~- C! W% O$ i}
$ |6 ]7 o+ A$ d. k' ]
, v, F$ [, ~. }+ l8 A9 Ufunction doWave(n)
, _  j4 _% D1 J/ @; v6 @/ l{   $ G& j: d: {6 M4 O2 g8 c
        theText = "JavaScript";
' P5 F" b1 @$ i/ ~% o) N1 I9 c        sizeCycle(theText,1,n);
* J$ F0 ?4 W: ]. ^  g5 j        if (n > theText.length) {n=0}
+ x1 s/ p+ u4 z% W! [- [' f        setTimeout("doWave(" + (n+1) + ")", 50);0 J* I9 Y# E: H( b" x* @
}& A0 v4 n  ?5 r" L& a+ m  M' I+ Z
</script>* U4 X5 M; j+ V- r
<div ID="theDiv" align="center">$ \% g! e+ L. w9 {

5 \9 n$ G- K3 O1 O/ |</div>, m$ a! r+ Q2 u' Z- T/ O
  ]$ I; M0 ^6 `5 q7 V# T
$ c. x  w2 h" v6 X9 {* n
& U. Y+ {" u/ K8 v/ b5 ?* L

" b$ v* K. f% T. o6 U第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

返回列表
【捌玖网络】已经运行: