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

|
网页之跑马灯文字特效
//修改宽度
8 u7 h' j( }2 g' vvar marqueewidth=300+ z5 U2 Y( f' s( @0 H" v3 {
//高度- b Z; G* G4 ^
var marqueeheight=25
' [* \$ k C2 O+ h9 b//速度(1-10)) ~! z, C, ^! B7 L, |/ ~6 p' f6 n
var marqueespeed=3 h2 d, P/ ~. p
//背景颜色
' Y% R! Y- r% p. A" Q7 i4 m5 dvar marqueebgcolor="#FFFFFF") I* j3 ?$ S# [' |$ L
//是否能暂停 (0=no. 1=yes)?4 y1 B9 e( p* y% ^$ n8 B2 ~
var pauseit=1, g% l/ U! }! y% F f" J3 s A, {
- L& J! j/ I/ i+ M7 A6 c1 A//修改显示内容
* @7 b% U/ g0 n8 n! l0 Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# U1 \2 W( b& F8 a: O+ k
. Y8 C5 s; P1 u3 \1 }2 W% T/ Y
1 ?& B n- b. w P: v) P////下面不需改变////////////
3 W, j9 y# F+ A: g; Z o2 p2 {% n; {; F; V! |+ Z2 f3 d
var copyspeed=marqueespeed
% a' K8 [" ^8 i: l1 \& U- R. rvar pausespeed=(pauseit==0)? copyspeed: 0
8 G) x; P" t$ O4 T3 R3 o. E* wvar iedom=document.all||document.getElementById: ]) r3 p2 Y8 ]' t9 A6 @7 a
if (iedom), C+ |( l l& e& f( ^) j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* S, J) p4 D0 H! R, |var actualwidth=''
" } n2 ~, m- i1 j# \! }% b$ wvar cross_marquee, ns_marquee
4 V1 ~& G, r- P9 ~- P$ o$ Z/ i$ m3 `8 E# q: L2 a9 _
function populate(){& m( L3 c& k" g9 f& e/ s' Z
if (iedom){
5 [- t& y9 p6 s8 pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ y5 v) ~) \- D+ pcross_marquee.style.left=marqueewidth+8. S+ o; Z) f; x7 J& V: D# ?, u" e
cross_marquee.innerHTML=marqueecontent2 v( L/ x/ Z/ V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* Y* Y% X% M5 m1 e( a' L2 P}( o& Q) t; y' m+ _3 w
else if (document.layers){
& ~9 e/ V6 T: c! ~/ {4 ~- a; Yns_marquee=document.ns_marquee.document.ns_marquee2, ?. u; E7 w; k- Q- l w( u5 m* M
ns_marquee.left=marqueewidth+80 @/ v1 P: s2 c
ns_marquee.document.write(marqueecontent)
( d# M/ \/ b: Q0 E* ens_marquee.document.close()
/ S& X+ q3 G/ Y4 T: k( ractualwidth=ns_marquee.document.width: X9 C p* E. h* h" j5 D) e
}
( G5 ]$ S5 s- r5 slefttime=setInterval("scrollmarquee()",20)8 J* Z: N& I+ g. _, O/ |
}
2 G& T7 w- D/ L' k, _$ v6 Swindow.onload=populate: I' F# a: W+ B) o. @
# _' c; e) {: S0 D3 Gfunction scrollmarquee(){
( l7 G c2 {% d) O4 A$ | Aif (iedom){
3 k/ d( Z, w* m l4 Q6 z5 V) f$ Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( ]. \* I0 r& R& r# u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ K5 Y' d. z0 K* M
else
- B/ N/ g5 N$ a+ f. s ^cross_marquee.style.left=marqueewidth+8& y2 Z) u% `. t( t2 ?9 u# f9 I& {6 j
! A" |! _. h# q, r+ ?# `9 y! d+ w}$ m# |0 _# [/ G7 W5 C4 b
else if (document.layers){
% V5 k: o+ {4 R2 bif (ns_marquee.left>(actualwidth*(-1)+8))# A5 B7 j. |, R u
ns_marquee.left-=copyspeed+ \4 h! _: V3 i) y( }
else
! K+ G/ h/ g, Y& q- Q% Y" p0 tns_marquee.left=marqueewidth+80 Y: E% b& u5 b2 c
}
8 Q) R* L/ [, T+ h2 S}& h" \+ ^( \ D( I" {7 V' U, \$ X
& H; A" l7 E8 t- s' u5 V' qif (iedom||document.layers){
9 F: K( u1 R- n: t- z$ jwith (document){* |# c( v- D" ^$ m' G9 n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" `: [ h# o' j% Bif (iedom){
3 U: S# ^) v) e& a# cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 a. N b9 M, J& i, G9 ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& @6 q7 Q# ?0 q. ?0 J8 B& D0 s( f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 }8 K, K( ?# c: s& X" ]" z! Fwrite('</div>')6 B K. U K! k) X
}% z; h9 Y! D$ _
else if (document.layers){
$ _0 c) u, | ]% ?# q+ Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). N; V$ l2 h! o9 k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( ]: \8 I$ e5 c! e# Xwrite('</ilayer>')" _, J/ x, O) l+ K- Z* H! `5 V, C
}9 b3 u2 p( E/ |0 b
document.write('</td></table>')
/ R5 j; R5 \0 ?# d2 P! |}" U$ P8 c8 g6 P; Z
}
, ?- ~: {- M2 r: d</script> |
|