返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' w7 w" @: E% X7 V% U$ y- |var marqueewidth=300
7 r9 a9 a* K! }2 m9 A4 ~//高度
( ?0 ~/ }9 o2 `2 xvar marqueeheight=25
( N% |4 s) z3 Y//速度(1-10)
2 n" `" Q1 z( Jvar marqueespeed=31 h6 x! f/ t7 C5 f$ K1 q  t) e
//背景颜色
0 y- x$ F7 y2 M3 ?var marqueebgcolor="#FFFFFF"/ z! {  Q5 T8 C7 N$ n
//是否能暂停 (0=no. 1=yes)?# s. j1 W: J6 J: J
var pauseit=1
8 S4 B' R4 V4 t' |1 d: n% b8 X. l' s6 c% E# i9 o( ]6 S* C/ G' _0 H
//修改显示内容6 a( C8 i6 l! e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# `5 f! q: v2 n

8 C# x. b) K3 h! Z# D
" [* D4 l# q0 K5 X$ D* E2 V* x////下面不需改变////////////
% J; W6 y  g# S: T% l" c1 ~% N, i. U  z1 \, D9 W  W" l! X
var copyspeed=marqueespeed) I( t1 z7 h/ v( Q/ i" ~( m
var pausespeed=(pauseit==0)? copyspeed: 0
2 t* C& I- K* B; a) F" Nvar iedom=document.all||document.getElementById- o3 Q4 d7 Q% C! C4 ~6 i  x$ K9 H
if (iedom)
. f/ F1 d+ B3 h* Q/ b7 s1 E/ r7 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), Y1 l( |# Z7 A( ~* }6 N
var actualwidth=''0 ^. z% Q% ^, X  v
var cross_marquee, ns_marquee
$ {3 O* H8 h$ C( }0 Z6 @0 N% C2 ?! W2 [7 h3 a
function populate(){1 W) {# F0 J# A# o. G3 Y" O' d+ N( ~- j
if (iedom){$ f  x4 X+ f/ _$ i$ W# S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! p4 S8 J6 F7 O0 }cross_marquee.style.left=marqueewidth+8
6 ~  D/ N1 Q  t( Pcross_marquee.innerHTML=marqueecontent
$ z/ q! c7 G1 b+ O/ Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 P! Z% y6 a) y
}
6 `1 r5 L- y4 m2 Delse if (document.layers){
3 r3 C3 _, ?" J5 t0 a$ y' Y) p2 bns_marquee=document.ns_marquee.document.ns_marquee2
! T  w% r$ Q+ f7 f. B5 o) Ins_marquee.left=marqueewidth+8
. h+ O5 S+ [- z+ ~ns_marquee.document.write(marqueecontent)/ M( V3 `& f5 `5 w; m1 [
ns_marquee.document.close(), c2 ~- Z* M. L; G) i
actualwidth=ns_marquee.document.width
! [& h- a6 r7 Q" w}, t$ _- I/ s* V* g" E
lefttime=setInterval("scrollmarquee()",20): ~5 j; d+ F. Z' v8 _
}6 A+ u& N* b0 A/ ?4 k% f
window.onload=populate
5 b% @; r, G3 c* M, _# b: n! I4 f$ ^" ^3 D. s
function scrollmarquee(){' x0 Q/ ?4 b8 d6 b1 O# _- r$ u
if (iedom){
1 L: Y% \) h; g0 Y5 n( j- {( Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 M9 c6 e' i. f' w3 U; F8 }
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: o. i/ @# Z7 G/ W3 J- n$ u0 N
else
4 V! C0 ~  Y5 o9 scross_marquee.style.left=marqueewidth+8
+ {$ s0 k. U3 [& C2 G
! j# @$ T8 X, Y# e& Y}
( z6 k9 E' s7 {( V. o6 T4 ~else if (document.layers){( D$ f" G, |5 E9 ^# g: s
if (ns_marquee.left>(actualwidth*(-1)+8))4 Q) a! c- k7 Q" j; f! H
ns_marquee.left-=copyspeed
" X  N9 f' }) b. P+ P, e+ Ielse
8 d5 V: s7 {4 wns_marquee.left=marqueewidth+8
' n8 `5 l" B0 d0 w}, p& Q( y, w9 o  O# p
}& I4 N  r0 ~2 g7 A2 U8 I2 X
7 U3 h4 @& @9 X4 W7 a9 O
if (iedom||document.layers){% Q/ R6 i/ F+ e, t) A
with (document){
9 }, {6 q2 }6 e. v: Q1 ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 Q. @+ Q/ I! [
if (iedom){
) A2 V" o' D& I6 f; D7 c* k* u8 \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( b2 d8 H) t* r! l& ]3 |/ c6 zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# c5 x2 z+ a' P9 f. c% \5 ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. I( I' r  p" k5 g6 y( @6 y' i: Iwrite('</div>'): x( `7 Q5 q+ p" W* k# \
}
- C0 H& h  J7 uelse if (document.layers){
5 ~" L: F& x) o! O1 N: vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" Y: D  k! \% b% zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 z% j; z3 o  \. q/ t, Zwrite('</ilayer>')% V/ t, A- H6 J* |- y! W
}( D. R# ^4 A  U' e8 a& s3 Y( y
document.write('</td></table>'). c+ W2 L; E8 P% A0 O! D7 s
}( o+ k1 s+ A+ x6 S# D  o
}
3 m+ t! F: ^7 i# o) w! u</script>

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