返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 w0 F- c5 u6 h. L5 M
var marqueewidth=3004 l# G, e0 P( C9 j+ Q; G! d
//高度5 t! L5 X) [: G# J" p+ e+ Q% C
var marqueeheight=25
; c1 ^8 |  ]8 a  F4 u//速度(1-10)5 Z/ ?2 [/ q0 I, x6 E2 O* E
var marqueespeed=3) j3 x% ~4 H% N% L! B2 O
//背景颜色6 I  M4 @' r- v+ R0 u; ]( e
var marqueebgcolor="#FFFFFF"
% F3 l  {; \/ k# E1 e//是否能暂停 (0=no. 1=yes)?
1 p: g9 u' E- {% x' Rvar pauseit=12 r( ?0 R- s; X  L: Z, U% z. ~6 T* e% f

1 Q1 O3 n+ F3 e0 `0 V//修改显示内容. C3 h7 I3 T# V$ q3 _( `* y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: j# j' V" p  O/ B
) U( `# ]# U+ k2 n- m% u( B8 Y6 @6 S# N& b
////下面不需改变////////////
+ f( }8 h. ?' [; \
, l( V( \% T, Mvar copyspeed=marqueespeed% o5 Z7 ~1 e5 Z  L8 C9 F
var pausespeed=(pauseit==0)? copyspeed: 0, _" B  y9 V% w+ y, P
var iedom=document.all||document.getElementById4 X  O' W+ D' C/ l( u, m' H
if (iedom)
# y: N) h* W9 a/ C: b3 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% w4 D+ e8 E: k4 l1 tvar actualwidth=''
2 U+ `# z% `0 {( B/ Lvar cross_marquee, ns_marquee" T; C6 S- r& G3 P

  \$ A# F4 j: R+ v. J5 g  L8 rfunction populate(){" Q6 _2 T! w+ K! k/ W; i8 s0 x  ?
if (iedom){" Z: @( y0 x0 B2 H1 y8 O4 h* k  C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: g/ C2 Y- @: S6 J. g  @7 |: ocross_marquee.style.left=marqueewidth+8; s' f/ U% W2 k0 g, j
cross_marquee.innerHTML=marqueecontent
! s% B. W- Z5 \! L6 c9 V; xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 S0 J% g  ]5 h* y}# |$ E& f- ^5 Q5 [2 J' A
else if (document.layers){5 V, }9 |; w/ I( {* E
ns_marquee=document.ns_marquee.document.ns_marquee2
( Q# `6 C) Q; L+ |ns_marquee.left=marqueewidth+8/ R0 c% a0 o6 c1 N
ns_marquee.document.write(marqueecontent)7 l2 O6 E6 R5 T, X- C  k( R+ t
ns_marquee.document.close()
( {& K+ ?; c" m$ m6 Wactualwidth=ns_marquee.document.width
2 M$ T8 t/ @! `5 I" e( c}6 A6 D0 X) n  n+ M; O) z
lefttime=setInterval("scrollmarquee()",20)
# f$ S# q' b) y}4 I! `2 s* T$ s) @  x$ f# \
window.onload=populate9 E3 i6 V' p  ~/ [$ S
' B2 a% P+ o0 j% |
function scrollmarquee(){
* r/ ^# i# E& f6 Fif (iedom){- ?* t* E- n, o% p2 |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) l/ p1 @' S. q8 i9 n4 W: Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 i  \: n( D7 q8 f0 u% _6 belse6 ?. c' H' S6 ~7 l
cross_marquee.style.left=marqueewidth+87 {+ C) B# Z" h0 f/ y

6 g2 o7 X' s& M+ a3 ~( @# a- w* r}+ d4 ]$ a3 t& Z& B
else if (document.layers){
! [/ ^: n0 x2 B; X( t! }' {7 Oif (ns_marquee.left>(actualwidth*(-1)+8))
& ]2 u! x5 [: Z8 x7 `+ N4 I+ bns_marquee.left-=copyspeed
# V7 M7 C% g. A1 E( A! zelse1 ^8 f8 p: A; v3 U) H
ns_marquee.left=marqueewidth+8% x- M0 }( L: D0 i: j! M
}
- Y) p; x, D$ B7 F: g4 N) s}4 S( b/ \. T1 f

! t; V, y% P( y6 Sif (iedom||document.layers){
8 R' D) B4 C. gwith (document){
- X9 [4 k7 s7 {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' l1 w0 D8 }6 R- G) F
if (iedom){
! |4 w2 \6 B  {+ E8 Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 q8 j$ v4 @3 |% Q# D! Z: ?# i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( T4 V9 E* W6 O, p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* u6 n5 G/ ?+ d2 T& e0 nwrite('</div>')
8 c: y& ?) f& u5 ]}0 e+ h# j% m3 k# P0 c' A) ^" v
else if (document.layers){3 b; W% F* F( l/ a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& L+ `3 `2 a4 V3 o2 ^% e) Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 T! B' c) `1 L5 H
write('</ilayer>')
' |" r& f4 D3 d' H0 |7 y) Q}
7 U) `1 T8 `& ldocument.write('</td></table>')
' |8 {: `8 r- c% i8 c3 c% K# {# h}( {% W+ H; H- D; b: G  n9 M# i
}4 O5 \- H* n/ k* z* \( s$ b2 }
</script>

返回列表
【捌玖网络】已经运行: