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

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

脚本说明:
/ {4 L: J+ h5 k2 J4 l  {
0 q( c: {0 }, i0 Z8 u1 `第一步:把如下代码加入<body>区域中4 t# g- ]8 s9 `* c
<script language="JavaScript">
+ A/ C" O5 l" j/ ]4 k. R+ j6 }! d) Q" M* m5 r) C1 e( r9 q
function nextSize(i,incMethod,textLength)
* V& H6 _) M* u{: v& a  r4 [4 e
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );7 X1 [- |% [4 E2 Z5 Z9 m5 {- l
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
9 p7 x1 G# f6 M- {2 G}& Z  F9 P# I5 J# [9 Y4 Q+ e
" [: {: W/ x$ Z; d3 h
function sizeCycle(text,method,dis)
0 R- i% L' r0 [{0 Q0 }# g. ]4 j' A% Z! e  k
        output = "";) f' y& w# a( S7 m* r8 W
        for (i = 0; i < text.length; i++). p% B- `& K' v" ~% ~6 [
        {2 K, j5 _) n+ ^0 L" s& ^  E0 [
                size = parseInt(nextSize(i +dis,method,text.length));" {. w7 H, ~; C9 w2 B1 C9 f/ T- e
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";: S4 A9 n6 \3 Z) L0 j) ]; m
        }
$ c2 X7 d: R: l  ~- ~5 X        theDiv.innerHTML = output;% ?' g+ [8 Y* P* {. X8 @8 j
}
, G! ^/ L- B$ Y5 z5 V' J' I5 l* d9 R
function doWave(n) 2 _) X% K+ S7 |0 _9 v; Y# i$ q
{   ; _/ Q! ]# `! M1 B- I
        theText = "JavaScript";# @$ J" m& T3 t' t3 H
        sizeCycle(theText,1,n);# f. c6 d. B2 O9 t& M
        if (n > theText.length) {n=0}9 b$ i6 X5 u+ }" `
        setTimeout("doWave(" + (n+1) + ")", 50);
# f5 |$ Z9 W" u% Y, z! j}4 [" q. H$ R; F+ L. M
</script>3 S' C- B, }' T, {% t8 ]9 y4 U
<div ID="theDiv" align="center">! z6 ~7 D7 K+ K3 M

3 T8 ^& }# P  u' p6 W# p</div>
9 u) V% q7 M+ m4 a2 c# S& Z
( y3 w. B2 W1 R6 E- J& V& |- a2 c# \5 r$ w7 M

( a- t  k  \  ~' G9 q
* y* W" }8 m1 L+ x( ^: g: T第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

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