返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 w+ s6 v& o# f! O% t' I
var marqueewidth=300
6 Q7 s' c+ ~. w& n$ m//高度
# s* g, j4 |1 o5 t2 ivar marqueeheight=25* Q6 q$ R& j" s1 ^
//速度(1-10)
2 J- Z/ o1 ?. _! Mvar marqueespeed=3" E) V& k1 q* \- \( i; M
//背景颜色% g$ f( m) l  f
var marqueebgcolor="#FFFFFF"# C2 I1 i& T4 \: j  `
//是否能暂停 (0=no. 1=yes)?7 U- l9 I5 a4 Q+ E
var pauseit=1  x1 j- V' H( L
! Q4 R* ]/ a% S- v; N3 h
//修改显示内容1 p+ B6 g6 W% l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 {& V+ V& T/ K: l& k3 t
5 F* A* M' }. n" B* [! ~
; ~# a  a" z9 o( V6 {) m. [4 ?////下面不需改变////////////; E1 o* \( x% `

, `/ C5 x7 B' ]. E9 Q4 Hvar copyspeed=marqueespeed
! E! v; M2 s: e- X5 Zvar pausespeed=(pauseit==0)? copyspeed: 0
1 T7 y* T( r+ o# i; E0 Pvar iedom=document.all||document.getElementById
3 A5 T, J7 M* Q0 G6 U% Rif (iedom)
! t8 X! }. }, j: w7 Z! U* ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& H3 d; u" R7 K- A% V
var actualwidth=''" m8 J8 ]5 s3 L  q5 \5 _6 k( e* R
var cross_marquee, ns_marquee
' P* t$ }7 I- [% Y8 Y5 I7 M* C8 a7 O+ J+ f
function populate(){
; a6 D' R5 M' U) x* Qif (iedom){
  i. `% M+ \' h/ ]7 b4 E$ ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' |7 ?; O1 V, T, z2 G
cross_marquee.style.left=marqueewidth+85 p% L% C- r+ A+ N3 X0 T6 y7 z
cross_marquee.innerHTML=marqueecontent6 X6 P6 f! l# l$ c' D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# x* f# g# E7 Z& t* N# H6 s1 e( N
}
/ [1 Z1 W2 U6 M- Delse if (document.layers){, A. ]5 ]% d# e" z: \/ k' `; I) d
ns_marquee=document.ns_marquee.document.ns_marquee2
2 U. Q4 @2 [* G- D  [ns_marquee.left=marqueewidth+83 `" h; G+ d/ J; ?9 X' x5 p
ns_marquee.document.write(marqueecontent)
% E; ^( c3 X6 T% K: Hns_marquee.document.close()
- v' j8 H% w2 G  L0 nactualwidth=ns_marquee.document.width
7 K% k% o  q; a7 S$ q- s7 c}
' Y" ^' P" n  P! d: zlefttime=setInterval("scrollmarquee()",20)
4 T" z) i$ S2 J) Y/ B' _) t& n7 X; ?}
) X5 q2 f$ C# O/ J; a8 Awindow.onload=populate
8 K9 M+ p6 `& {% U4 Y* [) Q8 q# ^- ^/ k
function scrollmarquee(){
+ ~6 s) j; S  I0 _' U7 Tif (iedom){
, {+ O. v- I# _9 i2 Y6 `: Y* fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 H: f' p# R$ \7 c# ~8 i0 [% o% ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ A8 V; E6 }/ g( d/ d' J. O* W* L
else  d; T* `+ A( ?4 ?# T  _
cross_marquee.style.left=marqueewidth+8
( O* \  h/ T6 K( e3 x" f2 Q. G  s' b5 F+ p/ h
}
; {) X1 @0 T- Y  \* o( @else if (document.layers){/ z2 P2 k- m- }7 T  _
if (ns_marquee.left>(actualwidth*(-1)+8))
) F- j, U, ]2 ^% m4 U$ Y* N! ans_marquee.left-=copyspeed
/ ^" ~/ O, I( T5 n" z9 s# Aelse$ R$ J9 \, a6 t% y" L6 t# S
ns_marquee.left=marqueewidth+8
! A* g& I4 P( _" ~9 A}/ q2 S2 w5 l* ]9 x
}8 e1 I/ n+ d7 _; v5 d* A$ X6 U9 K
- M+ P1 U# H0 w# H. o  F
if (iedom||document.layers){" t. E' \/ [6 I8 Y& o
with (document){
) f: S( V# r  C6 Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! [. `0 F% O( p/ X
if (iedom){
! y4 K" {3 |' qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: _% M, y+ Y) q2 K9 k& d7 C/ f% nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 M& }2 _1 [9 Z% kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ R0 y7 s' k4 O1 {( Xwrite('</div>')! @1 \7 z  x  N
}
" r7 v. k3 h5 ]/ m7 e* Lelse if (document.layers){& W6 l8 f' U( a& {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* u4 {7 D7 D; b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 C" p; W# y: ?
write('</ilayer>')4 X2 v, E& o9 J' @) m
}- d  R) k) f# H3 P
document.write('</td></table>')
( B# x! Y2 z9 x4 F) x}
9 q0 G" f# Z" c, Z, K% t: V. p}
% ?% T8 ?7 k! w</script>

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