获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 H: ?+ K0 i7 e& Y1 m- e2 U4 yvar marqueewidth=300
3 [  c8 Z; I8 A' i//高度" ]2 q; r% B% X" b
var marqueeheight=25, h! w/ l, w/ s. _) z' A" \
//速度(1-10)7 x& a& c* [# G6 x+ }9 j: c
var marqueespeed=33 e2 Q, z% p/ u. c: d
//背景颜色* D! K  z/ v( F4 q+ ^) s. m( e
var marqueebgcolor="#FFFFFF"/ a, E+ K# x* G- ~$ [
//是否能暂停 (0=no. 1=yes)?1 b6 Q1 H" V' z3 J. Y: E
var pauseit=17 t% H8 i1 C$ c: ~# P  ^
) h7 p+ u# e4 C+ G! y
//修改显示内容
" x- z# M% O  r: Y; |6 A; evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* L5 E  i3 w# |8 k) E5 Y& C4 E& p. h+ c2 {2 X8 ~' ?7 U' H
3 H: B  ~1 O, j
////下面不需改变////////////
" N8 o" h' u- V: z4 f6 z! G9 y* [: ]% ^
var copyspeed=marqueespeed- F9 D$ w8 i. a+ P& j  y
var pausespeed=(pauseit==0)? copyspeed: 0
& `6 U7 V9 R/ H8 fvar iedom=document.all||document.getElementById! C/ Z  P8 ~$ D0 {- a
if (iedom)$ g" n# R' b+ ~2 M/ m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 W1 [7 c1 P# m/ f' X* Qvar actualwidth=''
( N. l1 f4 C+ I/ |var cross_marquee, ns_marquee# G; Q( A& v( T2 T. f

" V! b7 D$ ~3 A" zfunction populate(){
  @+ H: T5 p2 p8 u5 s4 E1 pif (iedom){; C/ D) Q4 l7 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* ]8 V" T5 B4 P2 y3 Mcross_marquee.style.left=marqueewidth+8* J8 O7 w% j7 w' m4 B
cross_marquee.innerHTML=marqueecontent5 ~$ s$ ~5 _9 p% J6 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# I4 k6 c3 A9 K* k9 K}
3 I1 H) `3 a5 U0 j. X1 ielse if (document.layers){5 ]6 O: W# }6 M
ns_marquee=document.ns_marquee.document.ns_marquee2
( E# l; {$ p6 Y# R8 K% ~ns_marquee.left=marqueewidth+8
  B" r7 f: M$ L2 fns_marquee.document.write(marqueecontent)+ u# S" K- \7 t% ?, {* h
ns_marquee.document.close()
8 i+ V  c- M! U- R- j% sactualwidth=ns_marquee.document.width: o% [. z1 R  ~8 Q
}
' T6 L7 F! C! T* t, o2 clefttime=setInterval("scrollmarquee()",20)
* P! m2 `; k: c  E) e0 [% m}
- \" s# B; X0 k2 C" Z, ?1 a8 xwindow.onload=populate7 d' g/ f+ @6 d2 C
  ~; m5 O% e* \! x7 }% q5 \: k( \
function scrollmarquee(){
& d7 [0 Q" x9 Lif (iedom){
( t( A5 R3 r( N2 Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 b0 b5 e+ [' h% B) y9 Q  _) s/ \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ S, C" I) a1 f
else
' x3 R8 m$ J; L2 Y6 Dcross_marquee.style.left=marqueewidth+8
% O8 w& e( l! Y& R  D7 J* T' G; \& f2 M. V) U% D0 f& w: K8 g8 l
}  a: H1 |0 {" s& u
else if (document.layers){: D- d! E9 N8 D4 A; T; Y3 J) }
if (ns_marquee.left>(actualwidth*(-1)+8))
# l+ V: @. X1 Q, F5 v7 {ns_marquee.left-=copyspeed& Q! f' k' u8 P  n" Y5 z
else
" W* t* u- }; J- bns_marquee.left=marqueewidth+8/ p4 M8 g3 e; v& |6 H
}
6 D3 G0 z  I* i, ~' G5 z1 s9 F}
7 F3 m% g" W. _" V
, z7 r( |& |1 uif (iedom||document.layers){" J& e7 ?6 G6 w  T
with (document){# ?2 C& @' f: J' u/ K- D) m2 c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( u% d  s% d- g: D$ ^
if (iedom){/ X: q, D4 Q% x; e5 `  d1 `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! V: ^: V, g& h. j
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 {8 g) m# V# ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 [9 f# N% Y5 D+ m+ \
write('</div>'). O  O0 ^% \# a8 O4 z
}
: M0 b3 `/ ?8 }- _2 celse if (document.layers){3 T4 L/ h9 X9 W& y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' \' Q3 J% Y: K/ D2 B+ y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, h1 j( F9 t! O, i4 e  Rwrite('</ilayer>')
5 T! B/ [* U$ t" o9 z! _) a. Q}" j" D3 Q  S' i$ ~, I2 R+ V5 r
document.write('</td></table>')! S; n. |4 ^1 u' l; a
}# M0 d( C1 R, P
}
; H8 x1 ]. o8 Y, h3 x/ V</script>

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