返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' V& {( m# ?" ?: Mvar marqueewidth=300! B, V' M' R% ?% w/ i# J2 O
//高度. a- t9 ~- r5 e4 d
var marqueeheight=25
1 m; ?4 O& F/ y8 i- K* Y//速度(1-10)# `1 ?9 W' _6 j' z# _$ u
var marqueespeed=3
" |5 x% A$ o) [: X//背景颜色% n5 k* E  m+ p% B: P
var marqueebgcolor="#FFFFFF"
$ p( k* f5 W# L//是否能暂停 (0=no. 1=yes)?
9 n$ R- s" l* t1 U! _var pauseit=1
2 T0 Y5 P+ A6 ~4 I" \
  |, D4 o" b( I5 i, x//修改显示内容
' h" f+ ^6 n+ d, \( @# [) O) vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 x& @" [$ O/ A# _

- L! Y3 z0 x3 `6 P- o% P. \$ c2 S/ U7 d0 V8 u; k( C* M! ]
////下面不需改变////////////
2 T( O& Y+ E6 g* G5 X- q7 Q2 h+ ?! J$ B5 w9 p& |( r% P3 q( s$ b/ k
var copyspeed=marqueespeed
$ z5 e5 J5 L9 v3 `$ S4 }# V$ Kvar pausespeed=(pauseit==0)? copyspeed: 0! t4 J9 A( i, L
var iedom=document.all||document.getElementById
( I. ~/ v" Y% k8 Z# [: A8 x, Mif (iedom)
* f! o$ F& R7 B4 B5 ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- ?0 ^6 m4 q3 ~3 ~+ _3 Avar actualwidth=''
" ?3 [  E7 t. D3 ^var cross_marquee, ns_marquee8 x, T! @" W* ]% j) H
) Y& e" ?. i+ h5 @
function populate(){- \: V. z# h9 s2 [9 n3 a7 `2 l
if (iedom){: Y2 ~% ?7 S7 G: U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ t, r' R5 }( B5 E3 b' U
cross_marquee.style.left=marqueewidth+8
5 y$ X/ F3 M6 U& C$ z) Q/ w0 Rcross_marquee.innerHTML=marqueecontent
4 Y+ h) r! {( P4 v; ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) N2 B* o0 [( f8 ?5 O}# N& y) B  D# `
else if (document.layers){4 R2 v, O' d2 K+ v% p8 r: P% e, l
ns_marquee=document.ns_marquee.document.ns_marquee2
5 b' ^% I0 Y, q- ?8 x( Bns_marquee.left=marqueewidth+83 O8 i: V+ B4 [
ns_marquee.document.write(marqueecontent)
! q; g3 T; [: U4 w1 a/ d; Wns_marquee.document.close()
, m: X( |* m- N) t. I6 U* qactualwidth=ns_marquee.document.width
* p; o( o  u) g6 N& s}
9 W4 ~2 P" C# a: klefttime=setInterval("scrollmarquee()",20)' k- m/ ?+ L' |! k0 W/ `) W
}1 u& n8 k  {, A2 i
window.onload=populate5 n, t: V6 a7 ~/ Y

1 _8 ~! j2 h8 A6 X0 Nfunction scrollmarquee(){
) Z/ p2 t( i9 q# p) s2 y# h" S& f' Qif (iedom){. ?" V* c0 s& F% C* e. H9 g- E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* z9 a5 @# v- a% R$ qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 N( Q6 ]8 z9 w' y( x: Q& F0 L
else
" D6 s! d" C+ x+ ucross_marquee.style.left=marqueewidth+8( H& K/ Z$ ]6 T3 k: K

! u( r/ E5 q6 T6 I; |) ]}& j! Q/ l1 Y" H, \9 u! T- r
else if (document.layers){" ^, [0 t3 ]0 T9 t: \
if (ns_marquee.left>(actualwidth*(-1)+8))1 K% }  ~" m7 P, k
ns_marquee.left-=copyspeed
4 H  a  @$ o: ~7 |8 F" helse+ e% J) v9 V2 _9 I
ns_marquee.left=marqueewidth+8, n5 `* \+ k, S7 J0 X) p0 s& c
}! a, }- b0 s! o# Y
}
2 z: `8 i% a  Y% @
5 a4 w0 D2 H& |. j0 b# K6 R8 H6 ?if (iedom||document.layers){
- Z6 t8 _6 Y; ?with (document){, x/ G- ~9 J4 X$ T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& _; d2 z$ t" }$ M* a* I
if (iedom){6 S: d' p6 P, m
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( E3 |/ k' ]2 dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): G" A8 `# [" x2 J% T% Y# E% _2 P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 F2 e9 w6 t. d9 t0 O1 swrite('</div>')
* _3 p7 S/ u+ `9 V& g& Z+ M}) Y% g; y) }% q1 u4 z. a0 L
else if (document.layers){# m; U& _5 X( }/ K# t, p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) i  y( J3 _! O  r" @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' {7 M* n/ D! `$ ~) W  _4 w" B/ s$ bwrite('</ilayer>')
5 r8 M- @- N' ?) Z+ d}6 c, I( t: p; L
document.write('</td></table>')
9 N, j! P5 A& U- ~) E# J. |}% S) W8 b" L8 @7 w( O
}
' l6 M5 U5 \4 [& t7 Y7 X9 Q</script>

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