返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 s7 q; j2 K: z# u+ i3 _7 ~) M0 j
var marqueewidth=3008 Y7 ^4 `6 |, F8 K
//高度) j  w( X( M* }3 x, o4 p8 W
var marqueeheight=255 V! k+ c- I( I% }
//速度(1-10)& B$ v& J: t% m' x! V# d
var marqueespeed=3% e9 ~! ?0 N! u5 g) c6 O6 h7 ^
//背景颜色; z5 f" f; G, s! p( S% c  d& K+ j
var marqueebgcolor="#FFFFFF"
! {9 Z& z5 \1 O//是否能暂停 (0=no. 1=yes)?
- S& H1 E* x/ nvar pauseit=1
# E3 {, ]7 o3 U" D; ~- k$ Y1 ~6 x) W, K; g$ G) E: }) v
//修改显示内容
1 x* s4 L  c+ Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* H: W5 N; T: k  X( I+ i0 a
. [+ H, t' _: q. h& D. |% b7 y6 d  w- L+ N
////下面不需改变////////////8 P  _  L! T+ A% S$ K
0 B/ u0 B6 d5 N) n: M
var copyspeed=marqueespeed# v" \7 d4 U/ i& m. x  ~
var pausespeed=(pauseit==0)? copyspeed: 0; q. o$ E# D5 o. X  R; h; B; s
var iedom=document.all||document.getElementById
1 R3 }2 ]4 i8 c( H5 ?if (iedom)
& T" a$ [' X/ A+ ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. ^9 z  Q" ?1 H, R# N' s8 Fvar actualwidth=''
8 u7 M- t& v$ \' X: E1 R/ k; Jvar cross_marquee, ns_marquee) e+ Z% l7 F' ?2 z; b

' e$ t- q6 {/ f3 jfunction populate(){8 O$ }6 z1 i/ Q5 }: r
if (iedom){
# A( n+ j4 P0 f' O) _! x0 w* rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% M6 k+ N9 F5 r6 w* J1 d
cross_marquee.style.left=marqueewidth+8; o2 |, k- E+ V% ~" `
cross_marquee.innerHTML=marqueecontent
) A( k- l: `" }  e3 i) cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 u7 I2 R6 {5 B
}
4 R- h( w% v  \! M& d6 nelse if (document.layers){6 l: m1 J/ y# h' ]! z
ns_marquee=document.ns_marquee.document.ns_marquee2# }7 u# S" f( R# ^4 _* d; f) ^4 d
ns_marquee.left=marqueewidth+8
5 P# L: u3 d* d  d, P, C! ~ns_marquee.document.write(marqueecontent)- B  m2 W% @4 p4 }
ns_marquee.document.close()
: s# A/ i/ {* L4 Aactualwidth=ns_marquee.document.width, G2 X* c" E, S7 m% v% v1 x2 s: ^
}
$ K# N- J0 ]( @4 D& F- ]# ]lefttime=setInterval("scrollmarquee()",20)7 T/ F! A* m3 x0 K" }
}
! Z' P# }# l4 i2 x+ ewindow.onload=populate$ ]( u. G  p+ _0 g" X. b: N

* I8 F6 r3 K% I% E3 cfunction scrollmarquee(){
* a6 d7 L! e! T8 B9 q4 ]2 w3 ^/ v, uif (iedom){
" `- h! r/ x+ J# f" qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. t. c4 X- T" Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; G! u: N9 l' K# N$ }' f
else
( |' n: K# I8 R; B* B& S, p$ B' ]cross_marquee.style.left=marqueewidth+80 z* }* O' u1 {& f
1 u. C# H* [3 a6 a* u. `+ |
}/ w) q! |) l* A
else if (document.layers){
0 V) [, B' u: B8 q/ P/ ^if (ns_marquee.left>(actualwidth*(-1)+8))0 E2 u; T/ {4 O; v3 m/ k, N! _2 Y
ns_marquee.left-=copyspeed
9 b" U7 {0 H' ]( `% D5 j7 _else( T8 s' @5 c2 L/ {) @1 F
ns_marquee.left=marqueewidth+85 O/ R, R/ v6 S7 W
}
( Z; K1 h/ @9 @3 J  ]& k" I}
( m# k) t5 D1 q* q2 p) {+ T2 s& y0 }% G
if (iedom||document.layers){1 G/ p5 a; p0 c; M" l
with (document){7 I7 {8 s+ c2 l- u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 T3 E. m" x& \- U3 T5 _) h, }if (iedom){
8 ^) z3 J; c5 G$ hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ x& L3 }8 Q' H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ Y: \$ e) V% X+ \, H4 ~  {# Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), U/ v/ I: t8 v, `% a3 q9 R9 n
write('</div>'): t2 E3 H- b) A% ]* A( v" J
}" `( r$ b1 E( r
else if (document.layers){! _+ ~7 i( I- Y5 Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) x: f8 b1 o1 y( e6 awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). K, k8 p$ h9 i8 g: B$ U
write('</ilayer>')3 B( l7 f! o  f, n3 h( H
}
" H. h2 k* y! sdocument.write('</td></table>')6 c3 |* U2 e$ L* L1 {! T4 V! l
}7 H" P! e) M. f' `5 T% v
}
+ G4 j5 P8 _8 U( S  w, t0 ^</script>

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