返回列表 发帖

网页之跑马灯文字特效

//修改宽度! T) q$ d7 Y' g, G9 H4 a: I2 m% U
var marqueewidth=300
8 J. z; }. V# E% w% ]1 [! H//高度  Q& G; d3 |7 F* _
var marqueeheight=25
/ Q# c- `/ j0 y//速度(1-10)
3 V* [0 q( _. C8 q8 Lvar marqueespeed=3
! a& _2 s) r0 h+ d. Z# o  B1 i//背景颜色6 k/ y- `( a( O+ h/ o
var marqueebgcolor="#FFFFFF"
2 S" O7 S$ l9 l) k//是否能暂停 (0=no. 1=yes)?
! f1 ]2 b( H" P7 L. |1 X& @3 A& Nvar pauseit=1" `0 i6 Q% Q! ?$ ]: @
" G# T# i* Z6 t& y) G% X
//修改显示内容
- l+ u2 C; f* [4 W; A8 x- h% Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. V6 _- T* z; l6 z" R7 ]: d% [! ?1 A# A) b! Y! e+ y# g& _
0 ~; a$ z9 D4 i7 L, V( X
////下面不需改变////////////
+ y* G7 Y& H3 I* u
5 H- _. s9 s( u0 b- qvar copyspeed=marqueespeed
, k7 t* D7 j$ E, E7 s. P, c3 Y: wvar pausespeed=(pauseit==0)? copyspeed: 02 a( ?, K0 M4 ~" ]& I! J4 d
var iedom=document.all||document.getElementById
  I5 s2 m7 Z! W) Q' m* ]8 V% bif (iedom)
, G7 v* C2 v" s4 l/ {, ?+ ?8 Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' p  E7 d5 z2 V* kvar actualwidth=''9 T. y5 n4 I9 i, a7 [  ^/ Y
var cross_marquee, ns_marquee$ n: E: j  \  s6 j

* S/ l7 O9 l# w9 m9 cfunction populate(){
3 Z$ }* y0 h4 I& P" Hif (iedom){
, E+ K5 O4 }, ^+ kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* d! B. q4 y7 P5 G4 Y7 Ucross_marquee.style.left=marqueewidth+83 f) y$ u/ m: g1 B: i
cross_marquee.innerHTML=marqueecontent* n' C5 o6 A$ J$ h& ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* `& i: u, S9 e( H( w
}
. t* l0 i/ f) B+ `else if (document.layers){$ E: O$ r( Z1 `1 a: A
ns_marquee=document.ns_marquee.document.ns_marquee2) L0 E' l) S- A& i: W$ j) ]( i3 B( O2 ^
ns_marquee.left=marqueewidth+8, \$ k& o- A% ~
ns_marquee.document.write(marqueecontent)2 I/ n+ U" T* u
ns_marquee.document.close(); M6 r  i) ?( H  S8 U1 C* [$ h
actualwidth=ns_marquee.document.width6 F+ G' g  g6 w( R$ q. m7 N, I
}  K% }9 {. Y* C( F
lefttime=setInterval("scrollmarquee()",20)8 Y) P) B0 j. H. Y3 S- X
}
( F. L- D2 i( Twindow.onload=populate* M' W# H+ F5 B. W

( _* j/ Q, x' x) B( ffunction scrollmarquee(){/ J" x) l# z0 b) g, W' j2 F0 k
if (iedom){
! ^" H3 j) o/ \0 d8 _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ Z8 f( `( |) h1 G/ J4 T( Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 |$ q: y5 b# g5 W! ?  C6 _$ x. ]else7 g' ]* s# w& ~( W; o
cross_marquee.style.left=marqueewidth+8
4 I1 d  p5 x$ M& V& W5 G9 j  _# w9 I# t0 _7 \
}
: r2 L% ~7 g6 e9 X- h" j  ~else if (document.layers){
2 Y/ D6 u: u6 a( {1 fif (ns_marquee.left>(actualwidth*(-1)+8))* o# N2 M3 U+ W1 s" ~8 A2 _; k, c
ns_marquee.left-=copyspeed
! u+ i6 J. ^! u  ^9 Kelse* F- m0 t2 s3 Z, O5 J; F
ns_marquee.left=marqueewidth+8# X% z  O; j- x2 C" i
}
0 a- o; j( s2 g: Q! w( v. k4 {}
$ W+ h9 n7 l$ |& v7 n+ L! H% i/ H
1 x# m+ f0 H0 R+ z& fif (iedom||document.layers){
$ V3 T9 u2 O. v; o  d9 B, _with (document){5 x* w8 d" k( s; b- d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# \7 ^: V3 d2 i! o( h
if (iedom){- {- W: M% Y! t/ {% Y/ J( g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 G2 _2 V2 `" I6 D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. o. U" C/ v' v% J: C% }4 dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, b$ K, F  Q* P: s$ ewrite('</div>')
4 J& J2 P6 z4 M; T, e}9 W7 c6 S) V+ n# v" L  p- Z
else if (document.layers){  L2 @) ~0 u' w% d. W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% ]) F0 I7 ^' H: H5 J  @( ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 I6 s! A: L. K  E7 qwrite('</ilayer>')
# [9 J7 n/ C5 J; ?: a/ d}9 C9 f$ R: \+ N: j; N5 w
document.write('</td></table>')
$ A/ k+ v: w$ e8 q  I% i}. s/ ^/ I, ?; h- d; d
}
2 ~. e$ ~& e) [0 m# l; w</script>

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