返回列表 发帖

网页之跑马灯文字特效

//修改宽度. d; s4 R, N' h: ^5 p. I- Z! U
var marqueewidth=300
7 R; D- s3 _" P' h5 r//高度- j$ k. B/ ]2 ~' [/ g) d
var marqueeheight=25
% v5 e; p# J1 w& `$ C//速度(1-10)
* ^+ i% N+ o9 S9 t3 Z. ?# J. A- _6 {9 }var marqueespeed=3- W- h: W# \: S7 u7 r
//背景颜色
8 [" m$ S# b% k8 R* r& fvar marqueebgcolor="#FFFFFF"
+ ]9 @4 F* a# s: |" k//是否能暂停 (0=no. 1=yes)?
! V4 g1 q& n0 Z) Ovar pauseit=1, V1 b5 ^/ Y7 R- O

+ Z3 l' w# W9 p, `  n//修改显示内容" P( ?4 l) U- K8 X/ |% a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 X* s9 r1 [1 A7 x2 T2 G# Q5 _
8 ^3 Q0 S2 Q. K% ]  L4 P4 `
) Z$ i7 T& g  Z4 R: G7 \
////下面不需改变////////////* E! C) r, V7 ]$ Y( u

' P/ k. P6 X, Q! h9 ?9 \% W0 ovar copyspeed=marqueespeed7 o* O2 [7 c0 A8 Q: }7 `
var pausespeed=(pauseit==0)? copyspeed: 0" _, @; ^/ j8 m' a1 C
var iedom=document.all||document.getElementById# T9 c1 U, Y4 k/ F, L0 |% l' h7 y! F
if (iedom)3 U7 y1 k7 `7 |5 V" H  O' \( p" @7 \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 y' P9 ~8 B! I* ]% L8 Y; @
var actualwidth=''
( H- r  ?4 {  Z% H6 rvar cross_marquee, ns_marquee
' G9 h( x4 ]+ Q7 _' e5 D9 a( x! P) C0 z4 {
function populate(){2 g4 f6 ^% `" ]# M) Y/ {
if (iedom){  M  l% G/ s0 @  G" h8 i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) n) G# s: G! m+ r4 [5 o: z
cross_marquee.style.left=marqueewidth+8# ~- D( t9 D0 a( X( r7 R$ [
cross_marquee.innerHTML=marqueecontent& X* w( N- I* k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 }% r" P% I4 k- X}! N; j, D% x) h' B
else if (document.layers){
4 `" c& a3 o% D0 d' z& dns_marquee=document.ns_marquee.document.ns_marquee2
& D9 |! K* [: K. a8 nns_marquee.left=marqueewidth+8
' ]$ |( V$ q& N$ H& Ens_marquee.document.write(marqueecontent)5 v( w% W& U  |/ J2 _1 n, N
ns_marquee.document.close()
4 \0 R- I, p8 d9 n! \+ vactualwidth=ns_marquee.document.width
7 P2 A. z1 j, }* \- t0 g6 t}
, Q0 J1 W% H" \: Wlefttime=setInterval("scrollmarquee()",20). p- i7 }. B. a9 b5 f7 f. }" l
}. j. T* x. p. L/ k: M! L- U- k% w
window.onload=populate% E- C& |' V2 }

: Y9 n7 o* m$ W% I, r0 i/ E* h( W! `function scrollmarquee(){3 N" Y2 U4 {9 `2 I1 w
if (iedom){* ^+ B% y3 K+ h6 J
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), }0 L, L0 a" ?4 _0 d4 N+ o, e
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 N. ^$ [! L  u( E) x% L+ H/ r& {5 @else; T" F2 U. S* w/ c
cross_marquee.style.left=marqueewidth+8
2 Y! n5 o+ [( ]% t; _, ]
8 |0 M. ~) J# c0 E/ i}
4 S9 T' D" g+ B4 U2 T) Relse if (document.layers){- z$ I0 x& x8 u& V1 j
if (ns_marquee.left>(actualwidth*(-1)+8))
' i; P5 S& v5 n+ y; ens_marquee.left-=copyspeed
0 Y- y; R4 u1 b7 |1 v; K1 belse
. @* C' o2 p7 G4 J0 Z6 ens_marquee.left=marqueewidth+8/ [$ W9 _# _  f4 V# U
}: |* d% a. x/ g
}
# C9 x% F2 s, |* q: O
! f5 Y7 [" h0 Bif (iedom||document.layers){
3 J, x; n$ ^" \. j* {, Ewith (document){  ?) v, f5 ]2 \) W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% V/ C) v  q8 Y: gif (iedom){* O2 Y# `  Z2 \7 j3 n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, E! s6 }9 `" C2 }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 s) Y  f. t/ H, vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 A% k5 `: K- \  k( H& O) \8 a$ m
write('</div>')4 F# _% C8 P/ _# ~& O5 i
}/ G0 l: s  V% P; u) H2 u
else if (document.layers){5 H, D. h) J. o* ?) v5 ^6 S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 @1 g; M2 f' Y4 c; ?/ x" H* hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) \. {  v# q" y* ^write('</ilayer>')3 C) J' W  o+ k2 `) C3 b
}
2 V6 w) u& H  D/ q3 f( m. V* d4 R% Fdocument.write('</td></table>')
/ w# a+ O0 h9 D+ k. S}
/ q. g9 w2 H. H6 i}
3 S. @4 W+ f6 q& k</script>

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