返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 ^. ]# a" N$ dvar marqueewidth=300, v+ o3 i! X- C) I" Z9 D
//高度8 m2 }' W& J8 S, u8 A
var marqueeheight=25: P+ `0 W) i3 Z% K
//速度(1-10)  W6 k$ |1 a' b( G
var marqueespeed=35 a. O" T. i3 B
//背景颜色
4 n# F4 r- r; uvar marqueebgcolor="#FFFFFF"3 y/ y& R( c6 o& m: H! j% K6 ?
//是否能暂停 (0=no. 1=yes)?
7 `6 d# X" f3 W# fvar pauseit=1
( A* Y- @8 j9 o0 ^6 t8 M! \
. j. x8 Y  ?$ @- y. w+ Q3 ~/ {//修改显示内容& c! n7 \( Q$ F, ]* E6 j! D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 n. e6 C4 C# C! H4 w
5 q: d- Y/ F) B6 J3 r" t2 {5 C% K0 }& h
////下面不需改变////////////
4 s6 A, c" [! Q! W2 t$ W0 b* C! \# o+ M
var copyspeed=marqueespeed' e( N! U" g/ i: O8 r+ @, I
var pausespeed=(pauseit==0)? copyspeed: 0& q/ A5 n0 C$ Z8 q4 ~
var iedom=document.all||document.getElementById6 A% l3 c# s, C: N  I# I. Q3 S7 Y$ y
if (iedom). ]0 S  y  Z; Y4 L% S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! T: R, ~" W: A1 }8 W/ E8 Ivar actualwidth=''& M) u8 E/ K, K
var cross_marquee, ns_marquee
4 s. v4 K0 J% O  B$ x" @2 g) b
7 o) b& ~  }3 Q% Cfunction populate(){3 H- i9 i# S5 E9 X- ?5 C0 ?- A
if (iedom){
- u7 S' W" A* Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 E/ Y4 w/ U  O/ }* L: S1 W( ocross_marquee.style.left=marqueewidth+8
4 j0 a# r' O( ]- S. w  B: v) xcross_marquee.innerHTML=marqueecontent  Y6 Q% e3 T/ o6 q+ o. c5 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: K* F. F0 I3 j8 ^2 \- L
}
! W9 D* R, u+ V  [8 M+ Gelse if (document.layers){
  M5 D/ q. U# X& O& _ns_marquee=document.ns_marquee.document.ns_marquee2
' C4 H6 o( ?2 g& N  Fns_marquee.left=marqueewidth+8" V' K" m( R! {) G
ns_marquee.document.write(marqueecontent)
1 C$ m3 b' @+ i# a4 \8 Fns_marquee.document.close()+ {- k% N  }; x; }
actualwidth=ns_marquee.document.width' V& \) b* z- x$ }( ?- L
}- e% v* \  b8 }+ Y3 j( N
lefttime=setInterval("scrollmarquee()",20)
% g8 j4 L# ]) W7 k% l( b7 {}
8 X" K; l& t0 V% v$ |window.onload=populate9 E. [. V2 G# }4 x. F5 C# G

4 o0 d4 _- L; xfunction scrollmarquee(){/ D  _1 h9 H; \. K  a# ?7 z& J1 V; R
if (iedom){! V+ }0 t: ~5 e0 W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- k9 }. o& R! y& mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 ]8 P- F: x$ f  P7 ]else
9 ^& V' c% @6 @( |3 Zcross_marquee.style.left=marqueewidth+8! @5 X% q" J, [5 T& @
2 M7 _) ]6 s, l8 N
}
% f' \& Z! ?9 Y5 l  T: _0 {$ melse if (document.layers){
& n# Q5 E1 ]& r  t0 qif (ns_marquee.left>(actualwidth*(-1)+8))
7 k" u; j. z- W* C/ ~9 fns_marquee.left-=copyspeed) C+ j5 b% ?1 `6 Z( s
else
& s0 C! e/ q* p3 r( o1 K+ t2 cns_marquee.left=marqueewidth+8' p+ O, [# Q8 V7 [
}' F9 R, P% c+ U  C! z
}  @, q* B6 @& {: z: A" {+ D
2 d" R( B# ?3 @/ t$ O7 ~' D; Q& Q
if (iedom||document.layers){
& [0 M) v/ r/ w2 j+ ~$ j/ rwith (document){
3 x5 G2 `# R. B" ^8 Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 U. b1 N5 ?' m; {
if (iedom){
0 ]) q5 j$ g9 E1 x+ Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- \& L9 M) @1 Q- s2 E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). \; t0 p7 f: w1 y; j' b4 _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' p+ \8 R) x- Y& l; s
write('</div>')% Q7 ?; |# c& m% y& B0 L, H
}
+ u2 k% J5 m; Z. x* ^( ?; \! kelse if (document.layers){6 B, ~: R1 k# ~; J5 D/ u+ [0 s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) K2 C/ g9 S" ?8 t5 q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  Y6 l, E- k/ Z: T5 e( E# U/ ]write('</ilayer>')
7 V1 V! b& ?8 P2 ]1 x$ {}! I# a. K+ S4 ]2 K5 F1 w7 @
document.write('</td></table>')' e! {5 c% n$ G
}8 q6 w; G7 Q3 m+ Z; R
}( Y, I& }+ a# k. T- r8 O
</script>

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