返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; ?. _$ n* q. {5 avar marqueewidth=3008 \6 T- H: k  t/ I9 u
//高度8 R4 O1 V! S: R* l* ?$ j
var marqueeheight=25/ B: D3 N- o! }5 C: r3 }3 G- ^, u
//速度(1-10)
' w/ H( H, \. yvar marqueespeed=3! g" L8 t2 p; t* t
//背景颜色# W1 {0 o" K/ ^4 l9 f+ G
var marqueebgcolor="#FFFFFF"
# k2 J$ s) x& m$ o//是否能暂停 (0=no. 1=yes)?
9 w7 U; O2 R4 G- qvar pauseit=1* O! J- z$ \- u; c

6 C$ L* k& i# t" W, B# `) \//修改显示内容8 x, m; i( ^6 b5 z0 V4 Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% o! M2 ?3 N# @& E
% O. l( b; U- \$ H* |
" R" W. z! M* B9 S( H1 F. R////下面不需改变////////////
+ T, e3 D! b! b7 J8 J3 w0 O/ I# v, n6 `+ X$ x3 h
var copyspeed=marqueespeed
- o7 s3 B, x( l1 z$ \# q* Jvar pausespeed=(pauseit==0)? copyspeed: 0- F% \- t5 q. P0 M- z
var iedom=document.all||document.getElementById+ L) b) `0 ]8 S" y7 d% S7 `
if (iedom)
7 Z& m% P2 I1 \& ^/ Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& r4 T. @3 Y2 D7 e& }8 L6 |
var actualwidth=''
( C- R! o  ]4 Ivar cross_marquee, ns_marquee3 k- m/ q2 g7 g1 u9 G
4 k4 X2 Y, `8 D, Z7 E/ d1 J* m
function populate(){) G0 @7 H- H+ R2 |# }
if (iedom){5 }; C2 S* ?& W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 e5 a  L; p9 `  D5 {! k2 v) I2 v7 I
cross_marquee.style.left=marqueewidth+8, I: S) k8 p" x
cross_marquee.innerHTML=marqueecontent
, F! U" J* U# `/ {* C2 X, B: qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 D: k1 y5 K. a, o7 s}, p# B5 Z" V; K2 p$ N! c& W
else if (document.layers){
2 k: H. F, t; R: `: K) ?ns_marquee=document.ns_marquee.document.ns_marquee2
( r+ S/ \6 o9 ^+ Vns_marquee.left=marqueewidth+85 e2 G% L5 Q. R' s; _# a* n
ns_marquee.document.write(marqueecontent)
# j3 p, o( J  ?6 p0 R1 c) uns_marquee.document.close()
9 ^8 a7 N% S, H# K' H8 b$ Aactualwidth=ns_marquee.document.width
8 r8 {$ T. o; M& X2 h6 @- E}
* F3 V/ k& w1 slefttime=setInterval("scrollmarquee()",20)
4 w& A7 V3 A8 M4 P}
+ ~2 }7 O5 x) Y. y( b7 xwindow.onload=populate
8 E) A# S4 T# y( d' s  B4 V0 k( S$ t1 a# w" e$ J2 U( @
function scrollmarquee(){
2 p& N' M* R( u/ ~3 r# K7 kif (iedom){
/ X! F/ `) }% ?4 T4 T0 o2 Q8 nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; D) b1 j1 P4 s; kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 A% C3 t9 x; P& F, q
else
( T. G; _4 P& q$ M6 wcross_marquee.style.left=marqueewidth+8- Q, ?: R2 b- c4 q

  _$ @7 R' G4 O2 |}
( Z% ]) `: M) |# M: t& h, ~* \else if (document.layers){9 ~  `. V# ]6 R% K- `) T  q
if (ns_marquee.left>(actualwidth*(-1)+8))/ [& I6 U$ c0 ?7 V8 w1 D
ns_marquee.left-=copyspeed# x7 q/ w  z) K- ~
else, T2 r, b, q, D* y1 L6 L1 W5 c
ns_marquee.left=marqueewidth+8
/ E! _& v5 _! E& W3 Y) R, \5 Z}! u# {4 W( H6 L' B4 ]
}/ X! `! e4 }& C9 L; f$ h2 p8 A* f

3 {& L; ?* ^" P3 M% ?0 T2 |4 n! h- lif (iedom||document.layers){
1 r  A- }9 p- V! ]9 Y. cwith (document){7 N% L$ F' `1 k# k% o0 R9 C8 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 z3 Y; j/ {( s7 kif (iedom){7 F" ?3 b4 Y$ l% p- L, K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 \3 D# S1 i* h8 O# ]
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% \$ F  g. F+ N9 b8 hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  o& A& l9 ~+ s# @* Y& M3 i' c+ Cwrite('</div>')
' |. Y$ m; n/ c7 w9 N}8 Q: s6 }" p9 Z" C# |
else if (document.layers){
! S6 O; Z3 h+ Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" j6 ~- G5 }/ Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), m( v$ L* M: D; t
write('</ilayer>')1 S; |3 N5 N5 ]4 u# Z
}9 k/ I& i- G) i6 n& ~
document.write('</td></table>')' O! e! \  e/ S6 B) q& n
}# S6 G; W: F, W
}
( }% e: Y; U, |# D9 p</script>

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