返回列表 发帖

网页之跑马灯文字特效

//修改宽度% q# e' @5 h0 O: s0 @
var marqueewidth=3006 F- g4 l# a( u2 v6 @# z- ?
//高度; L$ t# Y: T) f5 `5 Z# Y
var marqueeheight=25
' H( k. f* T0 K2 A& z/ T. J//速度(1-10)
% {) _; F7 T6 e& e/ \. ?. s( M1 Hvar marqueespeed=3. j/ d3 }& L9 i1 a$ G+ D
//背景颜色$ n9 F- V' h) \/ W! M& p3 z
var marqueebgcolor="#FFFFFF"
9 f9 ^, y/ H' `2 @$ \7 Z6 N, z//是否能暂停 (0=no. 1=yes)?
& c1 J* u* s. t: Z- m2 {var pauseit=1) M8 N: P; S+ x8 \5 c+ f6 _

- E! S5 [) K; ^//修改显示内容* Y" T$ b! M/ N3 H- x+ y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 T/ M1 V( B! ]! C

' u( N, N: i) _5 A  y- P# j
: R1 v" [5 F* H: ^, B////下面不需改变////////////
  ~+ r# Z% J& A1 I& N8 Y5 N; o" h
0 r. K+ q" J# q% X8 C0 Z5 Nvar copyspeed=marqueespeed8 S% k2 c- q+ ^% L/ K7 y" c; C
var pausespeed=(pauseit==0)? copyspeed: 0, A* D! U( D& i8 d! n% w
var iedom=document.all||document.getElementById
6 O2 C* t. o- x; A6 \3 zif (iedom)8 p7 W3 `' u! C3 }( x# a+ R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% `7 t% K' K; M# K' D0 _0 f1 ivar actualwidth=''
, D7 _) s0 g# s- C/ zvar cross_marquee, ns_marquee0 e& x3 _7 e( b" S8 H" v
! t# n% U1 x& [
function populate(){& A; D2 O8 g& ~  D% z6 S% }
if (iedom){. Y" d1 ]. r" t8 Y: e$ Q  W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# U3 ^1 ^+ p- T7 o% m2 e2 vcross_marquee.style.left=marqueewidth+8- R3 i5 _- ]& p2 f( p
cross_marquee.innerHTML=marqueecontent  ^& z! L0 p1 c2 V7 i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 E9 c0 h# L7 [; k, _}( Y$ P4 {3 g6 h8 q
else if (document.layers){; g7 P9 X( Y4 [; G
ns_marquee=document.ns_marquee.document.ns_marquee2$ ]: R$ R, o8 J
ns_marquee.left=marqueewidth+8# T, R% q; f. o* C9 t3 V9 H
ns_marquee.document.write(marqueecontent)- \/ A8 l' j* K: l/ L0 `
ns_marquee.document.close()
; y5 B( C8 o( G. t; g9 oactualwidth=ns_marquee.document.width
9 F$ T1 w( D$ }/ u}$ v; k; d& x  U+ p+ \, D, d- E
lefttime=setInterval("scrollmarquee()",20)4 \3 C  C1 \: J- t0 n
}
% v8 T: ~# n( F2 Lwindow.onload=populate
/ a: q0 r3 C9 `
1 u9 L" T, t2 M5 \6 u$ Hfunction scrollmarquee(){
: E* m: ?, D! pif (iedom){
* B2 K+ i+ K2 E( r& P8 fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). N: ~" o2 P* t: z' D3 X( ~# n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' A, `9 K4 k" x6 w
else: F, E* E& V7 b  H' j4 c
cross_marquee.style.left=marqueewidth+85 N8 q" j2 b! D7 s+ U9 B1 D

+ z/ K! n: U6 O0 G}5 S0 n" `, Q) @4 T2 e& r3 Z: l9 F
else if (document.layers){" h; n7 Q/ @5 B- H) A- \
if (ns_marquee.left>(actualwidth*(-1)+8))
3 n5 r# c3 W% Ens_marquee.left-=copyspeed
% M8 a( D% c7 \9 `& f% velse
8 n1 g7 x6 G9 |+ z% s8 ens_marquee.left=marqueewidth+8! g( J' R* S! U) O* R' {$ c
}
8 U" N& l/ y, d% m, a}
: ^3 f& e& P# }3 v$ n
! I, |8 T0 i6 f" l0 C9 }if (iedom||document.layers){
  S, e0 S4 t) X9 R* k! z& [3 Awith (document){
3 S+ X4 y3 K" T+ w( e  adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- [8 l6 |/ D, m5 @
if (iedom){' X: x! M& T! s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# r3 C7 d7 W  B5 N# c8 m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 N3 A: x3 `6 v4 mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 s) ]$ V, S" S7 ]; f
write('</div>')
9 m# {/ a6 P" S3 b. @# G7 J}" B; T0 q1 X0 V, l
else if (document.layers){8 v; Z7 N8 D0 Y3 j6 h+ N7 b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): F7 n: ?4 b3 u4 \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), O+ s' t( X$ Q( P8 q2 W* w
write('</ilayer>')! u0 K5 c6 H6 }/ c! k
}( X; k) j) D7 N! g
document.write('</td></table>')- u+ |. c1 P( F0 @
}
$ N, K4 @3 n" B0 s& R}
" s. @# B; ^" V9 ]) O( r& Z</script>

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