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

|
网页之跑马灯文字特效
//修改宽度- G' o) H0 \* b7 L1 x
var marqueewidth=300
0 H K) I. M4 I/ I/ Z- A% j. Q//高度+ T# P9 G6 j2 k9 W6 U2 N: B4 L
var marqueeheight=25
! w5 t+ K3 G5 b6 ^% k& i//速度(1-10)7 @4 K; L0 K& i* W9 @
var marqueespeed=3. I- ]& v1 ^; Y6 x2 t) N: Z6 N
//背景颜色
6 q# i' Q C* r- L2 mvar marqueebgcolor="#FFFFFF"5 ^+ Y- U- [0 e* f* u$ _
//是否能暂停 (0=no. 1=yes)?
0 i! S2 m5 y" G7 [2 d' d2 Svar pauseit=1
% p+ w- \" z3 w" v, @- o$ b O5 l$ t* e
//修改显示内容
7 z2 Q! B6 v j4 @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* Q, r! J8 i J0 s1 k% c9 y, U1 t
1 u5 }4 B: H" }8 T$ D
# d1 M$ h+ V8 C6 p////下面不需改变////////////0 o3 K9 N; H- J) Y0 Z$ x+ }( W
$ ^% T9 e+ w; h/ ^8 V$ F x/ [4 @var copyspeed=marqueespeed; e- ?' d) O8 p% N! p
var pausespeed=(pauseit==0)? copyspeed: 05 C+ q' [ G3 Z5 d
var iedom=document.all||document.getElementById
b' l3 q. \4 A& K- yif (iedom)
! P% ~6 D2 |& t3 q* n& o* Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% Q1 }* t+ ~# X6 Tvar actualwidth=''8 E) l, }3 h0 o8 ? Q
var cross_marquee, ns_marquee
) p. m" t! H2 l4 W8 u9 x5 B2 S2 {, M4 l2 E
function populate(){
1 e- [! s; P9 Kif (iedom){
8 A1 e7 i M! p4 d1 M7 Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee S/ e5 T. c$ Y4 E4 s( N
cross_marquee.style.left=marqueewidth+8
# f% b1 N" v( E9 c [: vcross_marquee.innerHTML=marqueecontent
; Z8 C0 g P. a$ a3 g# U! lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% ?0 A- Y( G* T! }
}
) I0 p1 b z1 w- y1 n7 P" h- T6 Oelse if (document.layers){3 o" y P+ ?$ o+ }$ T% r# a5 k5 Q7 t
ns_marquee=document.ns_marquee.document.ns_marquee29 r) i! l+ `/ o. b' W: v
ns_marquee.left=marqueewidth+87 e6 g( {, N$ B' e% }" D
ns_marquee.document.write(marqueecontent); ?, a- u+ K! W4 R: t! q
ns_marquee.document.close()
$ I- }% t3 z8 C5 }actualwidth=ns_marquee.document.width
. x5 q6 ~$ j" U}
- Y. F5 Q& a1 T0 |; Slefttime=setInterval("scrollmarquee()",20)
" }4 f0 \, [/ ?/ C% c* m}
5 Q8 g) Z- N* R4 J% C* W6 Q |window.onload=populate9 P6 F& S, h/ h6 x/ z- C
4 x6 g) w6 E$ U
function scrollmarquee(){
9 _: G) r+ N0 l( Z' [ Gif (iedom){
C0 F3 {7 @# T: M! ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* }+ m- {* i9 w% u8 l3 I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% g; Y3 s5 O3 P5 h8 ~else+ W# [& G* R$ v
cross_marquee.style.left=marqueewidth+8
( M& S" E% m+ Q" x; _
. }/ m5 M8 w. s+ {}
- v& z9 k& }' c" _else if (document.layers){
7 f1 L& N: f0 Q1 Lif (ns_marquee.left>(actualwidth*(-1)+8)) F5 x f# `2 z. M: t
ns_marquee.left-=copyspeed
" @5 o7 h/ r+ c% kelse
1 y0 A2 v, P5 U. ~5 R* ~! Qns_marquee.left=marqueewidth+8) P# Q9 P' g* d* d; T+ {% J* F2 r* V8 L
}
( [" G9 N% N, O; P2 v) j4 ]: A}8 G! z7 ~5 a7 \% B1 j
- o0 {3 l a- B; I1 a$ T6 U0 O
if (iedom||document.layers){" @5 e9 }( Q# z: D
with (document){& H) C5 z& D3 T9 a# ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 y. _* f4 }, K+ ~9 l2 tif (iedom){6 ^* t7 q& i% N$ H+ `, _1 y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 b, _" n( B) k r- kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- ]" ^$ ^# J0 q3 Y/ N
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): w6 }7 p& g* H6 ]/ e! O
write('</div>'), A: j' y, i8 C% P1 h
}
& G. x- B: s/ ]- b# C( q4 Y; qelse if (document.layers){* ^ G( n5 F) v+ ?/ I( n5 B" j5 s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. v9 n4 [ t9 i, B3 [' Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- [& k8 B' C( v' ^
write('</ilayer>')6 f# u# f5 \! ^0 v( H
}' P E! G9 G* n( f/ T; b# r
document.write('</td></table>')" B! `9 _0 i2 Q
}
% i' ~: ^7 f- e* i2 V} G M/ v/ a- V" x9 A8 K4 R; [
</script> |
|