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

|
网页之奇特的文字变化特效
脚本说明: 3 q# H( o. g! q1 o4 ?
8 \" b+ @2 W6 A8 b第一步:把如下代码加入<body>区域中
9 v0 G! |9 p4 n6 }4 N% ~5 l/ o( k <script language="JavaScript">
: }6 M% Z. B$ f _& b5 q( f0 u4 G2 I! {
function nextSize(i,incMethod,textLength)
9 W% A9 V2 E8 u* P{. f: _* v) ]* z( ` `
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );) \2 m; { S" a# c; k Z! r
if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
$ Q9 D. V0 }9 x( J+ e}
. O! [8 \6 w k" U0 `$ G: Q$ L D1 N
; a; F, p/ g% S8 f. Ofunction sizeCycle(text,method,dis). d5 O6 a8 a: b) F' x
{
0 Z4 p; w: R& r9 [5 G! K+ ~ output = "";
6 ]# [. b, L2 j3 r# i for (i = 0; i < text.length; i++)
+ ^ P4 t$ N# m. S g% P; r q& H {) A; F& ?. R% [' r
size = parseInt(nextSize(i +dis,method,text.length));" o2 f2 _" g( g+ x& P
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";: v+ x. o5 _/ z/ A* s% U/ h
}
# `8 r3 C6 _) t& x# N3 v M! D3 I: u x theDiv.innerHTML = output;. |6 }6 E# I# l F8 w
}9 ]/ ?0 v& g( r& N
3 K, Q: {* L5 @1 b5 A/ }
function doWave(n) & D! C$ x6 \8 }/ L; o7 L# J
{ 8 D0 \5 j: H. h
theText = "JavaScript";
7 k/ |) w7 ~2 ]3 J8 R sizeCycle(theText,1,n);' J7 A6 ], m5 j& ~5 c: B, t
if (n > theText.length) {n=0}
8 ?8 c4 u$ e+ e' J! I/ \ setTimeout("doWave(" + (n+1) + ")", 50);
. h6 _6 F' | o. U% b}
* z, z, |2 c) f1 i! X: M</script>
2 l0 n G6 Q4 v1 ]- Q<div ID="theDiv" align="center">* p+ E& D7 V" U
/ r G& @& ~: b, S" Z7 F8 H: |
</div>( `8 t6 G* ]0 K& X( d
7 e* e. b; Y1 i3 o3 u q( U
3 O( E/ m. ~ j7 L0 O x8 P# y2 ]! q
: {7 B) C* K1 \) z4 G第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|