返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ `( E2 z4 _' P! \. [9 @. M/ g5 z' M
var marqueewidth=3007 S. R  B. X2 Y6 Z9 p5 y
//高度
* t% z( _1 D$ L2 c$ nvar marqueeheight=25# I7 o+ P) j  B+ i. M
//速度(1-10)& }1 k: J4 }) o7 P0 Z9 g
var marqueespeed=3; M$ w2 Y5 e' r) R
//背景颜色
+ \% E$ n* D7 m' t: Pvar marqueebgcolor="#FFFFFF"
+ H5 N7 H3 g& J# g+ v4 e& U//是否能暂停 (0=no. 1=yes)?
, z1 {2 ^! O' f2 @+ D. evar pauseit=1
" H6 O) K2 C3 m6 c: H
  U* ^; x2 T. J; |) ]* ~7 s0 t% b* V3 k//修改显示内容
' \& W2 Z. Y+ h* \. _& d" D* uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ T, Y6 ]9 t- X; p2 ~2 K, e* n
& o1 i' i6 C& P) |
" e' |" V4 M. Z+ }$ v5 z////下面不需改变////////////, o# K( p& _5 u  w! {

3 }/ |1 Y% G  M6 wvar copyspeed=marqueespeed
) x) r& V/ |/ o( s1 Tvar pausespeed=(pauseit==0)? copyspeed: 0
) @0 y! R* J2 a& qvar iedom=document.all||document.getElementById9 ~( O0 M* B/ \# S$ T& y0 p2 ]7 s. E
if (iedom)
8 g' U9 f0 ~, ~$ @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 B- W; \5 v! r
var actualwidth=''
* c- f4 {2 k& P: X' Vvar cross_marquee, ns_marquee
! I9 c! f, ~1 G# |
8 S. C' c1 a# q( ^/ mfunction populate(){
' t, V$ J% _. e: y' p8 Rif (iedom){9 J$ [3 p/ T: y5 d  {( S  l8 N# d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- ?) q$ p$ h8 B/ M8 P1 A7 G
cross_marquee.style.left=marqueewidth+8- |5 u& [2 F1 U: y. i
cross_marquee.innerHTML=marqueecontent
5 L" P2 h2 |3 W9 c+ U: U- r" aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" }1 N) K$ C4 {2 S" n2 @# G
}
. ^" O4 b7 z0 m7 Oelse if (document.layers){7 b, m" M9 D' q2 e6 ]1 n+ {
ns_marquee=document.ns_marquee.document.ns_marquee2: h" k5 V/ A# j+ ^' K
ns_marquee.left=marqueewidth+8) a. |8 g& W0 l0 Z5 o2 q$ l; q( c
ns_marquee.document.write(marqueecontent)
# }7 g% h% f8 E, Ons_marquee.document.close()  f1 `6 r4 C9 _+ g! j% h. K
actualwidth=ns_marquee.document.width
. n! T  W- _3 S& c* Y" _' D}
8 i2 T& G9 F, ^8 Y' _lefttime=setInterval("scrollmarquee()",20)* H3 f9 T4 c, n1 W5 C2 S% Y
}
+ X% L* H6 a4 \, K! s; K9 Ywindow.onload=populate! W! R0 ^- \  ?9 n2 _/ Y. N6 K! @, r
% ^  b1 i  u$ ^. Y3 @' \
function scrollmarquee(){
& W( z+ c: G; Z5 H. R6 S6 Tif (iedom){: g0 m( N5 T: l9 a- k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), T& E- M( F& N0 |4 k0 N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ N7 ?: \& v: b1 e( G, \- U& G
else
; }$ D! ^4 p& g* _cross_marquee.style.left=marqueewidth+84 M4 P& h! T  n/ u& L1 k6 ?
, c) X  o& g3 ]# K$ c
}
3 i, j/ m: V% }5 nelse if (document.layers){
; w  T" o+ v' h3 E/ Iif (ns_marquee.left>(actualwidth*(-1)+8))
( r' ]) d: d/ N7 zns_marquee.left-=copyspeed2 X1 ]. h. J1 d9 t
else1 O8 Z! D$ F8 c# K/ O) r; K4 M
ns_marquee.left=marqueewidth+8
2 S9 h4 R* X* e5 t/ {- S}& @% O% A! K( Y7 K6 U4 v
}
. j# N9 r' x5 b( V- P/ P
8 O4 @( Z7 M; l$ p5 }- l+ {if (iedom||document.layers){6 ?: r3 Q' u/ ]; _( f# r: L
with (document){' P, z/ |( T% B: e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), r, b( _7 `1 t* {, z. j! }
if (iedom){
& D+ O& ?/ h# S5 Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; x' r6 n# k; G3 V* F" y3 Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 ^  y! \2 f) b2 m7 T2 H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- U! a! P7 m3 }$ u7 p! V; O' N
write('</div>')
  I! e4 O+ V# A2 q1 U}
* _4 b6 p$ A: R" A  V7 J+ Welse if (document.layers){
* H, k  {: y$ |9 {; Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( w* w+ |4 x% C; B3 l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 B8 }1 I3 u, X8 gwrite('</ilayer>')
5 ]1 |4 T& |9 M. z$ ^8 p5 b7 m}
! K9 n  Z" |: r& R1 Z( U6 jdocument.write('</td></table>')- X0 W0 i) E9 f- S, `. ^, }
}
+ K/ `8 T% w( u* V" f}5 {& O4 _$ W1 N. e
</script>

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