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

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

脚本说明:
4 W+ G2 [9 `; c5 m2 P/ t' s+ S
8 Y2 r* {$ w+ i$ i$ q第一步:把如下代码加入<body>区域中
' z! k' i6 Q$ R9 r3 I) s4 t- S$ u- b <script language="JavaScript">$ _/ R& T. O* s1 J
, _; x4 V/ y( b# n  ?* t0 q
function nextSize(i,incMethod,textLength)+ Q+ a9 L3 I# C2 y) e
{
) _- P+ Y2 D, F7 I' l. nif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
# Y  Q  G8 S# X3 [- r# i0 U. tif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
: _+ C5 j0 c" ~9 V& b% ?}
( L, \0 l0 Q1 Y
& V! X' G5 H' g; W6 ^2 yfunction sizeCycle(text,method,dis)- J$ _9 Z: k- p7 T" E% U: x4 i
{
3 f4 u: k; e8 l: M: q8 S: w1 A% _        output = "";
- v- |% E7 {1 k        for (i = 0; i < text.length; i++)
) V/ h6 e2 _! F8 ~# A6 _        {1 y5 G# f" u( V; b  k
                size = parseInt(nextSize(i +dis,method,text.length));* R+ d: j& k$ ?' M0 o6 H6 }
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";  c6 f8 v) s" \
        }1 m. H6 @% E( J' H
        theDiv.innerHTML = output;
& |# @+ l1 ?( C' A}
# l+ n5 C) }3 {5 e- b
1 K; ?1 g& d% s! r$ z7 Y8 lfunction doWave(n)
+ w7 I1 O# }" B5 i. b8 j, t2 K  g8 B{   , W3 s' x% k8 G( s1 w; f
        theText = "JavaScript";
$ o, f! j/ Y: }6 `* X( ?        sizeCycle(theText,1,n);
2 s  e  X) S$ y1 a5 o        if (n > theText.length) {n=0}
8 h. @; a$ c/ _0 l        setTimeout("doWave(" + (n+1) + ")", 50);
$ [. i+ Q7 H" i4 v0 u5 I. E! n}
, W' @, s6 ]  q+ h3 J</script>$ Y# n; R' E5 z
<div ID="theDiv" align="center">
# b2 z4 a5 Z) A% t& S9 t
7 a& {, f9 X% a, t* Q</div>+ ^1 {, @1 D8 l' n. U" ^+ I# c
/ s# I( j& Z6 h

' m7 T# C7 Z) W% r, `- b, }0 B( u- m  p
% h8 ~4 G: E) G4 S( f  j
第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

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