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

|
网页之跑马灯文字特效
//修改宽度
; y1 ~1 H9 c+ s/ _var marqueewidth=300) u+ h7 ^7 `) Y1 [
//高度
z% w7 d2 x0 W8 ]) E6 m% {7 ]5 uvar marqueeheight=25+ s. ]2 r! P/ y( ^) [
//速度(1-10)% y5 x. P& x4 ?2 e
var marqueespeed=3! ~2 e+ m* M0 O( M# A- T: J
//背景颜色
# e. O7 B1 n$ a1 ]$ K7 I& Y; Uvar marqueebgcolor="#FFFFFF"
/ j% G9 u* ^6 }% S9 ?- `$ T//是否能暂停 (0=no. 1=yes)?3 J0 h6 @2 [5 G( K# u( {
var pauseit=1
/ q" _- g4 n$ m% R+ l4 L. M }( C/ M: t6 M- y: t
//修改显示内容
3 C- w: ~8 U2 g6 u' Y" Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 x8 j A6 H* P7 _
! Z( {8 j: q! [; {0 T
; @7 Y1 \- p$ ?) V" e* [. @$ ~6 i////下面不需改变////////////: I8 g2 J$ }& d: G2 U
* s |* z( N: ^* y0 J
var copyspeed=marqueespeed
3 d, D$ P6 |& {( s! c- avar pausespeed=(pauseit==0)? copyspeed: 0
) c. g: h, D" |& b! ]% lvar iedom=document.all||document.getElementById% m9 G8 M Y" x# A
if (iedom)) s2 ]+ E% D& v9 W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 N9 c( _2 z# a7 B: Ovar actualwidth=''( N1 b, D# L0 R* G# B
var cross_marquee, ns_marquee7 J" O ?( ^& z. _9 M4 B1 \* n
2 B/ F# ?( ~! m2 H! X# l* hfunction populate(){9 ~7 Z. g8 S; p6 G0 H
if (iedom){/ I) q7 J' C$ c; G) R: ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! q7 W b, }9 H: u# H4 ^4 xcross_marquee.style.left=marqueewidth+8$ v1 x' _: x! u5 G; O" X+ K" k
cross_marquee.innerHTML=marqueecontent) Y3 b* w; K) y: G+ e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 u5 S2 s! Q8 ]3 _) ^}+ [8 K( {; S/ w( f" V! j* N. E
else if (document.layers){
n# o) `" l+ F7 ]; D; bns_marquee=document.ns_marquee.document.ns_marquee2
+ A) T0 B H- f0 ]& r' Ins_marquee.left=marqueewidth+81 c9 z6 w4 l. P9 S
ns_marquee.document.write(marqueecontent)( I* B" h$ A! K {; e
ns_marquee.document.close(): b+ {6 o8 |. |9 g# J
actualwidth=ns_marquee.document.width
5 ~3 d c- \7 F- ~! n! @, ?! h& N}4 N2 W+ U/ j& y2 S: q) y
lefttime=setInterval("scrollmarquee()",20)- N7 U8 ~* w$ Q# c$ B q
}
) C2 e: i0 j7 r* F# ]window.onload=populate0 {( {. D3 A; c; A; R* c) w
% V# p6 R1 n) m3 ?function scrollmarquee(){
/ o e: N8 Z3 e! Wif (iedom){
, @( A- g+ M2 w: j' h2 k2 [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& z" s8 {6 o* A8 ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" x4 V9 z: [9 Jelse3 l, ], I( X6 U
cross_marquee.style.left=marqueewidth+8
& r' \) j( w3 f+ x1 i, S
1 }0 \7 A% T% h2 J}' ~ W' D; o! F P
else if (document.layers){
) H, l, G6 p% a% R" Fif (ns_marquee.left>(actualwidth*(-1)+8))6 m# ]- N) N$ U* i$ W
ns_marquee.left-=copyspeed
1 J' D7 L1 P4 T! c! Y) q; ?, t, gelse& B" B0 \% \6 I8 F6 A
ns_marquee.left=marqueewidth+86 E2 W7 S% t: o3 c: w: R0 k5 J
}
2 u. p, Y! m# r1 n}
. N, c9 a4 a# p# y2 f z' F' s* e3 ~$ V2 s
if (iedom||document.layers){* ~+ i0 f# |, W7 ?; I
with (document){( {% H8 G( Z6 ]0 ]7 j6 X# j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 {2 A8 I8 }6 W% f+ n
if (iedom){/ \; `! }3 M- u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). |. T1 d+ [. ^; Q) r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); Q. F% A9 Q4 w- X% `3 s, O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 j2 ` |- D2 k$ }7 {9 [# E; |
write('</div>')
3 f; i" P! u7 I- Z}1 L5 j9 h) v0 a; y% j, P* p; Y( @# o
else if (document.layers){; j9 h8 k& s* X/ y9 q) X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' h7 |3 j, P4 s1 v
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& y ^/ k) ?0 U, `) E s& dwrite('</ilayer>')
. a; k9 v; N9 Q}; e4 {) X( N3 ]" E0 V2 H
document.write('</td></table>')
# H0 n1 @6 u- h}: r9 h: N2 y" o1 X
}
" g; w" M( E+ N* p/ g9 H0 s1 i</script> |
|