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

|
网页之跑马灯文字特效
//修改宽度3 Q$ r+ p ^; }8 ?. _- q z5 s
var marqueewidth=300
' _, x6 d9 W3 ~, H# Q) x3 |//高度
& F) [/ A/ }3 X+ r+ lvar marqueeheight=25
. \! o. }' V3 D$ w6 j( D//速度(1-10)
. S. |2 w9 c; u* v7 X- p& O Avar marqueespeed=38 u% c. @; h0 v) S
//背景颜色
: a1 v% c, \/ h8 C6 ~6 w& `2 `var marqueebgcolor="#FFFFFF"
* [9 F) x5 _+ s9 }( a: b7 N9 m! f//是否能暂停 (0=no. 1=yes)?2 H: M& x# ^2 c4 b" j0 c
var pauseit=1
; r+ k5 ?7 {/ u! ~
: ?; H. ^% w! M& A6 T; J5 {- i; H, f" j//修改显示内容
* x }' Z+ Z/ |; h/ z8 p2 e. u# B7 ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') C5 `0 A6 I; d& @5 L6 G
4 S6 Y8 i) _5 w& h9 w( ]' _: C& ?. `4 }* q& s
////下面不需改变////////////# `! U1 F; m1 ?: k& c: e U
% Q( O; L8 j. Rvar copyspeed=marqueespeed" ~8 z _2 M: v8 G4 T
var pausespeed=(pauseit==0)? copyspeed: 0
3 t$ L% m/ ^" _# E( ] @ s! Z; Vvar iedom=document.all||document.getElementById
' r+ t/ }, ?. m) l1 v, m) Dif (iedom)
8 e& Q+ m$ |; M7 zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 n& R, ~9 n9 i, e" k2 X
var actualwidth=''
/ q2 l) T) N# ` e/ E2 y& C+ ^var cross_marquee, ns_marquee2 ^* O8 j9 s7 A. |" H3 G: ^. O
2 Y0 P8 \1 e$ M+ m0 H6 s U' efunction populate(){
4 \( b# L. l% n5 O! m3 Iif (iedom){, B+ g% P2 B' G b+ f+ u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
K% A4 g, s" d9 E' I7 [cross_marquee.style.left=marqueewidth+80 \* g% {; j% u
cross_marquee.innerHTML=marqueecontent
, k/ c2 Q2 c0 s1 f: s/ L: m! Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; `" g, z/ A! M' Y: a6 E. F}5 ^7 a, N% }' K$ v
else if (document.layers){' N) R9 ~6 z3 u/ i% |7 }
ns_marquee=document.ns_marquee.document.ns_marquee2
" J+ U, H6 c+ q x, J' ?2 ^# }: r ]ns_marquee.left=marqueewidth+89 K; f! ]+ L- ~% T0 \
ns_marquee.document.write(marqueecontent)& a7 g4 h# [5 ^$ m4 y5 e1 `
ns_marquee.document.close()/ w9 b: L7 e' [/ n' Q6 l
actualwidth=ns_marquee.document.width( i. D$ f D, h. R8 \$ u
}
8 ?+ ^7 y4 i" H, S P3 c) N5 Blefttime=setInterval("scrollmarquee()",20)
. s2 u- {* R* G5 `* c, U}
& F9 M+ F0 @: c9 [window.onload=populate4 r6 q$ N, y% G( b! k- P/ E/ m
# G! s5 w9 `+ I* \function scrollmarquee(){
5 V5 w3 [2 h9 n7 qif (iedom){
# F+ {- s$ G' P9 _% q3 p- ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 E- v1 j% G+ E* C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ d! O! y |$ Y! m' o: X6 m+ `
else. a k( Q8 T/ P5 Y3 `
cross_marquee.style.left=marqueewidth+8! q+ b8 ^, N; K; l0 X3 T
. W7 ^: \4 D- K) l7 x) m}
+ P0 S, i9 G6 T* o# ?else if (document.layers){8 s8 A; b/ u5 ^/ v, l8 ?+ ?+ A
if (ns_marquee.left>(actualwidth*(-1)+8))
# ]% m& B6 I4 gns_marquee.left-=copyspeed. Y6 \4 B& j5 T1 m
else
! i9 A6 \7 T$ A# Zns_marquee.left=marqueewidth+8# g* C! r( T" y5 u# \
}% {$ [% D2 Q/ r4 u9 \ \
}
% q; o$ R$ T9 X% }
( X$ a- O$ ^ Y8 s0 {1 O* Dif (iedom||document.layers){
7 z( C1 @4 \6 n1 z8 k/ w. E0 Rwith (document){% |* L" m! K# a: b* h* d8 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. F2 U/ y7 @2 x9 Y' q. Kif (iedom){3 P7 |- l. H. B3 A; a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ ~; Z$ @7 z7 n, `2 q) mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) b9 Y( G1 z! j2 \. f+ Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
f0 f L D: o; xwrite('</div>')
" ~4 Q, ]7 }( T8 j4 f$ Y* h; c}- b' I" y( c1 k V5 N. m
else if (document.layers){, A; x+ a& W& R, p; a# P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 ?; | e+ M. ^; A9 P8 Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* H% Z; y$ u: Y# O5 q- b3 Qwrite('</ilayer>')! m- ~1 n0 f" W( x
}: s& y) O$ X2 ]" |
document.write('</td></table>')+ T4 u7 c* H5 c0 @ C- d. O: @
}
; _0 w7 \. u+ @% [}$ z: l$ `% ] J+ {& C' k% ]6 N
</script> |
|