返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 K; S3 l# i: K. p* I5 Y4 Xvar marqueewidth=300' \- C3 p* k. C
//高度. J# e8 u' J2 p, y0 k/ A2 \: q  @
var marqueeheight=25
7 m9 b' n# b7 F* k% p: T+ p  b" w//速度(1-10)8 b, a) W+ [7 `, X9 m9 N
var marqueespeed=3
! M: l* g7 b# y; }1 ~) s//背景颜色
3 \6 `7 u$ t% u7 L9 z1 Vvar marqueebgcolor="#FFFFFF"4 n9 @) c9 ^# d3 d' _" h+ B# ^3 A
//是否能暂停 (0=no. 1=yes)?& O. R) x3 v3 o3 S5 f, G
var pauseit=1
6 v: F  v' \1 @8 X" s8 t. E( @2 H0 v2 o: H- |5 J1 E
//修改显示内容
8 n7 C- l8 L" Z0 Z( ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 Q( f/ Q1 W. ]- L* F
* h; m) l2 X; s6 J/ B! u

% z. u! h6 V- J+ j' A. v- y; [$ N////下面不需改变////////////
( y- u; u, t4 l% Y+ E6 |: \. I* t4 p$ k6 e- r5 o( k" f
var copyspeed=marqueespeed
1 P: ?( }# y" w3 R# L( v- Avar pausespeed=(pauseit==0)? copyspeed: 02 b' f. `- i3 h
var iedom=document.all||document.getElementById. O; z. W, T- K+ K& z  P
if (iedom). q/ `# g6 z. y* ^5 t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 Q: @  n: {2 O4 ^var actualwidth=''6 I$ [( l8 d2 n  i' r% t: `5 X+ `- o
var cross_marquee, ns_marquee1 ~9 G: y/ Z9 |/ J  z. I
0 B- ~0 Q: ], Z) u2 Z
function populate(){( W0 \; E; H3 W& L" r
if (iedom){/ |" j* n5 [6 I2 I: V; P4 e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 O2 A% j- m* f$ y9 D# @* \cross_marquee.style.left=marqueewidth+86 k* m  n) o8 b6 l# d2 ~1 ]
cross_marquee.innerHTML=marqueecontent
# x6 P+ p, n2 U4 nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 `% M$ a- l! \
}+ A2 ]* a4 E" w: D* U8 a# V2 S
else if (document.layers){& _* c. e; P9 C7 W5 p
ns_marquee=document.ns_marquee.document.ns_marquee2
/ W5 y% C9 t$ Yns_marquee.left=marqueewidth+8
- f( s; I4 p6 L- J2 \% sns_marquee.document.write(marqueecontent)5 U3 ]+ S% B  D% Z1 e( e- \/ C
ns_marquee.document.close()2 J) q! c0 D  ^  X  A1 Z, P
actualwidth=ns_marquee.document.width
4 }; L$ y7 Y, G}
! M) z" M$ x4 ^- m" Vlefttime=setInterval("scrollmarquee()",20)
1 i* A) p* e: H8 o: d2 h8 H# s}
% O# Y  h' R3 P8 v2 x9 {6 Jwindow.onload=populate9 `( C5 P6 O) I9 }: S: x. ~

6 {6 y  ^5 S  ]# q4 Y6 A8 Jfunction scrollmarquee(){
) F; E9 A$ x! S# d0 tif (iedom){
- }$ s! K: g7 x- x3 H/ B$ Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" H5 v  H/ D" r3 @$ T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 b3 c% k) W7 N- ?' L
else0 n' K" o2 z8 C3 M6 g' u3 n8 G+ D
cross_marquee.style.left=marqueewidth+8$ n1 `' H3 C' @0 Y0 I

1 L6 s* g0 T3 R6 r/ @  s7 {}
' W, B/ i& G* t1 E# felse if (document.layers){+ E( ~2 ^) A4 y6 f' X0 t' e% R! o
if (ns_marquee.left>(actualwidth*(-1)+8))6 N$ i! W( U" u" }4 @  f9 R  n2 Z
ns_marquee.left-=copyspeed
7 h+ W  g' x5 I8 l6 u  Velse
$ l* p+ n5 `# V  U/ ^4 T: t7 S6 ]% A1 Gns_marquee.left=marqueewidth+82 G$ c% U& @: r& h  ]7 T
}
3 ^& I/ ~4 K  h/ B}
* w6 V: t, |- `" y  v" e
4 V; ]0 u  v2 z; ]if (iedom||document.layers){
; m& Z2 \3 o, O! s: h  x6 fwith (document){  ~2 d5 x! F- W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  n% N2 B' R- k6 ]7 r' |# {
if (iedom){: d! B3 R8 c' Q$ Y  B6 L
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# x+ F' c/ l% {* b3 Y- M0 f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& U5 r5 N! o! m- P3 R0 kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 t( U6 ~& T- G" d! A, X: [write('</div>')4 @: \0 j: h! m3 a/ Q8 T4 c
}+ m- t2 L- p; N0 D8 a' H
else if (document.layers){
! w3 z9 s& v; i9 ^2 P" i6 S6 Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* h" o. b" d$ |/ b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). U" ?& N$ y0 u3 j8 o
write('</ilayer>')
& d7 r3 @* @5 ^) @3 Y, E0 Q}
8 O# m0 v- }1 t' odocument.write('</td></table>')4 @$ p' a" l+ Z3 I
}8 O2 k7 i: \/ k/ X" g% X
}
; n* Z2 g6 c1 e5 K( E! c3 b</script>

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