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

|
网页之跑马灯文字特效
//修改宽度
X3 b7 |& ~3 k1 ]( e8 Dvar marqueewidth=300) U0 n0 a0 B6 ]; `9 y3 H; D( I
//高度
7 j9 `" \# O0 d, t5 tvar marqueeheight=25
7 s' w" d$ v0 y( L& ^' [" E//速度(1-10)/ x3 F+ a$ n( V! G! ]
var marqueespeed=3
& N0 B& I" A5 k. }% x+ h//背景颜色/ \* T G3 ~. M0 R% ?9 t, C5 c
var marqueebgcolor="#FFFFFF"6 c: y3 n+ @6 }' e
//是否能暂停 (0=no. 1=yes)?
- m. P: f3 H5 U9 C9 W$ Avar pauseit=1! d. c. M8 W/ ^$ [ Q3 t
6 A8 O0 y [4 X* Z/ \# r; C k, W//修改显示内容+ I6 [3 A! @- n, s' t( B7 k2 Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' ~$ A0 S$ n5 e% ^# a. n
# G- V* k; \# I' A% ^6 Y+ A% s. l* `; _ z/ x3 m2 z' o1 D* D
////下面不需改变////////////
: A2 _: f, l3 I( H8 Z( G8 L5 ^ W
1 F- B! P: l/ B# b3 @var copyspeed=marqueespeed
1 w4 u& X. B$ {8 |var pausespeed=(pauseit==0)? copyspeed: 0
+ m3 q6 R9 h. P/ R4 r0 yvar iedom=document.all||document.getElementById, Z" b- {/ j8 ~2 |; s
if (iedom)
, A" g2 X, o# h T( j4 l7 L! ]- Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" s; H9 M _ |" V8 g, jvar actualwidth=''1 n: X) Q% j+ m# ~; q' h+ {
var cross_marquee, ns_marquee
* F$ b; e2 r9 s# D$ k. ]+ M4 ~
9 T, b% H. b$ P9 Ffunction populate(){0 D& {/ q b5 S) n0 j
if (iedom){, _( k& P& g' _) V1 o1 K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 n6 [* B+ U/ b) ^- i
cross_marquee.style.left=marqueewidth+8
+ \( s1 Y4 |$ ocross_marquee.innerHTML=marqueecontent Q1 a/ o, o3 H! p3 Q" w! h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% ]: `5 Q3 O" g6 z2 O7 R} ^1 t( l( y# M, n2 v6 d
else if (document.layers){. g. z/ E* k: W
ns_marquee=document.ns_marquee.document.ns_marquee26 r! H8 `" X3 O/ s3 E* \
ns_marquee.left=marqueewidth+8$ l2 j7 }( L* e3 P7 Q
ns_marquee.document.write(marqueecontent)
6 W% f& [: Q0 o ons_marquee.document.close()4 o2 @3 U6 n9 Q# d6 p1 i
actualwidth=ns_marquee.document.width0 @* S8 e+ I( z' y0 w5 f2 F: S
}
8 p- ^3 M- f! a2 v7 Rlefttime=setInterval("scrollmarquee()",20)) Y: G7 w5 `- f% q& p7 B! k
}6 B, T+ w2 U! Z0 p; G3 I/ M2 N+ R
window.onload=populate' m, k# c% H4 `& M2 k
0 j4 s2 ]! b: T3 l Cfunction scrollmarquee(){1 o( S: W( c- r, _+ [1 V' @
if (iedom){7 f9 v2 P3 ~) D& U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 ?+ G1 E% A$ J1 u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 H+ u D/ J0 u% P0 v; u; b$ p
else
& [- O! j7 e" Ncross_marquee.style.left=marqueewidth+85 Q2 @" Q( T9 L# f! [, i
3 t' T8 z2 u, n. A+ g
}0 z2 }$ r4 a0 u. T
else if (document.layers){1 T9 O C" [5 C+ r2 J* G- j
if (ns_marquee.left>(actualwidth*(-1)+8))1 M( t& g0 P v
ns_marquee.left-=copyspeed! k- A2 W0 R8 x
else
3 u) B+ Q( P7 N Hns_marquee.left=marqueewidth+8& j' h, x$ W* A+ |6 M5 P5 D
}& t- ^8 a# m( T+ ` w+ Z
}
& s" a) w5 O- z& `# ?7 v! G1 `, M
if (iedom||document.layers){% \ s K" q3 A3 z& G
with (document){
: w% |5 {" C1 V, N7 ~6 @" fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 e6 r# d, Y5 V+ g/ f7 N8 wif (iedom){
0 @9 W1 o$ K" \8 r7 Q8 z# ]: d0 Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 }* p) d2 l5 O* {- Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! C+ }/ O$ l- H; ^) y- j" rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% q" i% J% v* Y2 |8 y, x8 uwrite('</div>')
1 X3 w3 X: t3 G" a/ B' d+ n/ W* `$ V}! A) G+ u+ Y) H9 A: I) v2 q
else if (document.layers){' Z" [5 |2 p. K/ n4 b) r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 D: ]# O% e: O* s# N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# l7 W6 B' E# |) m. Lwrite('</ilayer>')
5 L: Q; X1 L+ I}
+ h2 [2 l% z$ g7 \document.write('</td></table>')
; n: \& U$ H2 z* K- h' I( i% @}7 f6 I- R& c/ T5 V
}
, Q# B5 P2 {- F% N</script> |
|