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

|
网页之奇特的文字变化特效
脚本说明: ) e/ {- n0 g7 f# D& F
' u* I H, v% Y2 z( O第一步:把如下代码加入<body>区域中1 X0 ?5 o, r% d& i# d
<script language="JavaScript">
* f0 Z- h+ _& P. o
8 D& f9 T- R F3 ~: \* X) Efunction nextSize(i,incMethod,textLength); O- d) W+ j/ }( l* C& ?
{
2 t. C' n. ]! `! W7 qif (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
# J E$ {; c; C5 U" ^if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
! c* I% S+ W- {+ y8 w" t5 v}
8 H0 c5 y: |" i) Q
( ]1 d2 |' x( Xfunction sizeCycle(text,method,dis)
" {& U2 L' h3 ~5 I; B3 N" w{
$ ^0 B: q) F8 A6 M output = "";+ r4 S0 a, X$ {! {. |6 [% q
for (i = 0; i < text.length; i++)
3 s# A/ f( V6 t& n" t1 F" t {
/ h! q/ O, n0 q5 V size = parseInt(nextSize(i +dis,method,text.length));3 x5 U9 d5 X3 x2 L5 ?* H2 W( @1 Z
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";. I% s# n8 N( ~- |6 h: z1 ^
}
+ y. |3 O* S' R) f- ]0 b' k& F theDiv.innerHTML = output;( z5 D6 J" j" |& ^% ~$ Z8 V
}
6 ~; c; o3 `3 g$ h: K: y* D8 V* B
# C4 s/ ]7 i, s! G" lfunction doWave(n) 8 T8 S* v* S! l" T
{ 5 k( u) c, r/ |& Y
theText = "JavaScript";
4 l. Q2 ~+ [8 O8 z' U$ a sizeCycle(theText,1,n);3 N+ U' ~% C( B( t* g# a5 `
if (n > theText.length) {n=0}
8 S- f. r: r, h6 \+ I# q" b setTimeout("doWave(" + (n+1) + ")", 50);, l& K( {- P0 Z; }7 [9 l
}" s! ]7 h ~3 e8 I. M& ~
</script>
! T/ m1 A j% ~( \( }$ R6 i! Y<div ID="theDiv" align="center">
0 T- t" D' M. L2 Q6 l$ y' Q3 A P' j, E* B6 a# b
</div>* z3 l! B& v: J; \. `" P
$ j+ S) N5 B* i% x& g. U
; ]2 i; D" |' X" |7 L6 Z& x2 A5 Q
8 Y$ s# S, m8 J( s% I2 q
% Q. `" u$ S1 X6 f/ w第二步:把如下代码加入<body>区域中<body onload=doWave(0);> |
|