返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 r- m" `/ C2 Q, T
var marqueewidth=300
, ~& H1 Q' i" q8 {% o8 a' X5 J//高度3 g/ u. X3 @' [2 ]7 i
var marqueeheight=25% J- C1 z& M* t) @% `' F6 f' d
//速度(1-10): l8 j0 A. g" S0 c" R9 }5 i' l# |
var marqueespeed=3
1 N$ F, V' P+ E//背景颜色
4 q( L) N3 `( a1 f3 l! Gvar marqueebgcolor="#FFFFFF"; U6 L1 T, t+ p" d- s
//是否能暂停 (0=no. 1=yes)?
: N0 i5 |; ~6 O) I3 B& [var pauseit=1! |1 @. W" G& p9 `6 q: A9 I. }
/ ?5 N$ l9 K) ^% `4 z( e
//修改显示内容
  `1 a7 a' x/ a; N  c$ wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. k9 W- f/ c, i+ ]8 m) U% j# P5 ~) U7 W8 F" S1 q+ l
2 N0 v; H+ `- H! v+ Z
////下面不需改变////////////
7 W8 v( y1 V* y) k9 t$ t) r4 D3 `7 D( I0 U# Z! v7 \8 |9 a* f
var copyspeed=marqueespeed
( G6 Z0 `3 q0 t/ Kvar pausespeed=(pauseit==0)? copyspeed: 08 A# Q! @, X; R$ @1 L( C* J1 _% L# \
var iedom=document.all||document.getElementById
0 y0 E* [4 d8 |& _6 r$ Vif (iedom)" o; M8 I; v9 X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! `% {' n7 I! G  ?
var actualwidth=''
" f1 P2 m5 N( kvar cross_marquee, ns_marquee
* h, t+ A  Q+ j) ~( `: L+ R
# I' N% ^; i3 l0 @9 `5 e, b$ b- C9 H4 wfunction populate(){
" L# y! ]& N. n' n1 z, dif (iedom){
* X0 r0 a+ u8 `: q5 `! E2 U' T9 v9 rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 b& W( A9 p, B3 w( A3 `1 k
cross_marquee.style.left=marqueewidth+8
4 }) s5 l5 l: B* d' i: |9 Pcross_marquee.innerHTML=marqueecontent3 i3 b9 H; `. K* E2 o! l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 j2 R/ a# B4 i$ I}
8 v/ u* m0 q9 U" Z/ B* y+ s5 Xelse if (document.layers){
2 \" L1 m9 F) T$ p" W- A' a& u0 [  [' C5 K3 Yns_marquee=document.ns_marquee.document.ns_marquee2
5 h5 [9 C' p$ Hns_marquee.left=marqueewidth+8/ r- B6 j8 w' `: z6 o- P
ns_marquee.document.write(marqueecontent)
5 V) b5 ]) @$ rns_marquee.document.close()2 y1 ~! _7 K1 P
actualwidth=ns_marquee.document.width
' d, |  {( ?' u}( X7 R; {  V4 V: Z% C
lefttime=setInterval("scrollmarquee()",20)
3 C# d! y0 L5 _}
: o5 J5 D# A% zwindow.onload=populate
& G. b) v+ E  t; \% i
1 n; {. w% e( }* Z3 Z# Bfunction scrollmarquee(){
( g6 C3 ?8 g: z/ xif (iedom){
  w" P$ o8 b+ m& nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 d- Y/ f& s( m, P- p6 y3 \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% p3 f# {$ W( W0 F# Z& p, lelse7 q9 p- J# |, [% b/ F
cross_marquee.style.left=marqueewidth+8( w( y% l1 L. g  b5 C
7 Q0 f6 x  ?  Z& T! m. A/ @
}: n% p/ s7 c# w  T* Z
else if (document.layers){4 r) A' @2 |1 t, `' e4 T+ E! X+ G0 G
if (ns_marquee.left>(actualwidth*(-1)+8))
' n& m  f7 f+ l# ^ns_marquee.left-=copyspeed
& J0 g9 A% X! i+ F) S# Z8 [5 W4 belse
1 z; `! o1 E' e6 D7 E1 N' xns_marquee.left=marqueewidth+8( E+ z8 j: ~' h: \% T/ H( g
}
4 i0 @6 @: `, z$ V}; `( x  Y3 O( L- s5 u
4 M- ~2 f( {" s1 ?8 A- A( W
if (iedom||document.layers){. J; B9 k8 u! B7 @8 E  i: M1 j
with (document){) b$ ^& k4 s% ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% D) \2 T8 Z% z0 v8 c
if (iedom){& }. n, o4 [0 w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 F3 D9 u1 f* g% f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, f4 U  o" [3 D7 ^' j" Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. \1 V) ~( ~4 A( Hwrite('</div>')$ F$ y9 _" n' k& y/ w& i7 ]
}
! ^8 t7 C. s7 X' l# x  r" belse if (document.layers){! K- y! O5 S# e" o, w$ y' m- U3 W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! ~5 L0 A1 X3 `3 e" |$ ^7 u) ?% iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) ]+ o' `( z1 i4 ?7 T! Z. i
write('</ilayer>')
; l* R  l/ q7 i: ~6 U}7 v  J7 G1 \: E6 b2 o. t! @
document.write('</td></table>')7 Q. A9 H: T7 e
}
8 U/ u3 Z- J. e# S2 S; y) w4 d}
4 {) r/ O, l7 g" |  T& [! \</script>

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