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

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

脚本说明:
. P9 d- ^; M! y, j$ ?/ V* y0 |   W2 a) p% M2 ~) m6 P; |
第一步:把如下代码加入<body>区域中$ N2 k1 X6 P3 E. C
<script language="JavaScript">
, M& f* E0 s) s, p! D7 \2 V; S5 C4 d1 v9 ?8 }: |" O0 U
function nextSize(i,incMethod,textLength), C2 ]& {3 O+ W8 s' b. T, N( R6 V0 D
{
& S" _8 w2 n- u# T1 aif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
* g, y! I) z; X  |# `) X; I$ oif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
: E$ e& ?* Z  ?7 h- ^7 z8 T, @}
9 O' X' S7 }" Z* ~$ r) [0 G1 w! ?0 H& r. A
function sizeCycle(text,method,dis)
8 f# Z: ~* @. }) ?3 p' a. H{
8 f  `) D" U: \+ F: v& |3 O0 I6 g        output = "";
# C7 H/ |. [; g3 c( I# N        for (i = 0; i < text.length; i++)) m* m, l! v! ]( S- i6 `+ B5 i
        {
  N9 a' C3 J6 ^                size = parseInt(nextSize(i +dis,method,text.length));& X2 V% s1 L; F4 n
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";1 t! C& v' p# P# u* i, @8 T
        }8 b) k# S( i& j- \6 h
        theDiv.innerHTML = output;6 v: C" c8 t  z- E
}3 \# y3 Q7 \- u: V5 V

( K4 t1 p- |) x- Kfunction doWave(n)
* L5 o; ~$ g8 F- q" ~3 z{   
9 \4 t) w/ s7 f* z# l        theText = "JavaScript";3 p  S0 U8 h  G( m
        sizeCycle(theText,1,n);" g' L! k% m; L% g! q
        if (n > theText.length) {n=0}
/ _, J$ C2 ]6 U        setTimeout("doWave(" + (n+1) + ")", 50);
, F! C2 e7 p6 f* d5 N: x3 F}
1 b- a* T& p9 w" R</script>
! r7 l9 D+ K( [0 E, i- w3 p) ^$ W<div ID="theDiv" align="center"># Y; d# ^* A2 K* \8 T2 c3 A

+ I2 I2 M2 N. P1 \</div>
4 P% ^9 s# |1 E; y- u. ]& J
; ?) y9 u- D! a! ]8 x& F) D5 P7 ~
: _2 U3 Z4 t9 ?

; J/ w9 d( }) ^第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

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