|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度( Q/ P7 N. g4 j/ k
var marqueewidth=300' E: ?9 {& A' N5 y3 L( U$ x9 L
//高度: A! D' ~ q0 G% ~- j& l7 X
var marqueeheight=25
& C) T0 S/ P7 G//速度(1-10)0 `# U$ f( a7 A
var marqueespeed=3 [( A5 [7 j3 j' S1 f- L
//背景颜色
, e& `( }( C. B( b& @var marqueebgcolor="#FFFFFF"
6 H5 ^! U# z9 s" \! Y P7 D9 f//是否能暂停 (0=no. 1=yes)?+ m9 U1 Y: f" p" R# |* A1 [7 T. p
var pauseit=13 A6 u/ M( T& v6 s
% e! k1 R w/ P n//修改显示内容
" F9 {! ?& I* O5 `5 Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- a, A5 p7 a$ \% G/ o0 l
2 P+ H4 j a ^
# H0 g6 d# M; S" H. G& N
////下面不需改变////////////3 A0 [# D6 v$ Z, R8 y9 L
' X0 K7 c6 B7 H& J& Y" F. |" Cvar copyspeed=marqueespeed
# V- K) G/ A! v+ s. A# Hvar pausespeed=(pauseit==0)? copyspeed: 0
1 L- R4 l+ D$ `* C+ T. uvar iedom=document.all||document.getElementById6 b) \/ F4 u9 U% c# S( A
if (iedom)& Z9 i% R) o- x& U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 H" O1 {* P/ Z0 mvar actualwidth=''1 {9 ~* _+ u2 |, P, J# S
var cross_marquee, ns_marquee
C2 s7 D1 v* b; N7 A0 | y9 h3 G9 x3 x2 K* e; o0 F
function populate(){) M, n8 I. b/ E
if (iedom){
9 N4 }" O4 x9 S4 o9 X+ mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( T5 [ f- H' H X
cross_marquee.style.left=marqueewidth+8
! o# T/ E9 |, ]cross_marquee.innerHTML=marqueecontent
6 `( k' T8 }2 m: M! f6 Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& }: \8 _' n- V) H; Q
}+ h H$ g- K% V; N! z
else if (document.layers){
( R+ e/ C& V1 b% I2 L( O" M( a6 u5 Tns_marquee=document.ns_marquee.document.ns_marquee2' P7 k9 a' L5 D
ns_marquee.left=marqueewidth+8/ t! F, U( s# K# o4 N/ P" E3 P* \
ns_marquee.document.write(marqueecontent), X+ Z7 C ^. q9 z7 R9 N f
ns_marquee.document.close()
% ? w# c( i1 D l% ~9 ?' Eactualwidth=ns_marquee.document.width' Y2 r2 q) w4 @! D9 p6 w
}( n2 j$ _2 r' Z* T$ Z8 p6 j& |
lefttime=setInterval("scrollmarquee()",20)
# c% v" I6 }$ _2 s}
5 B! y9 M' W- }" y$ \3 o; T+ Kwindow.onload=populate: ^3 _0 t$ c: g q. @4 ^
- R" d+ x# M# }# `2 S0 gfunction scrollmarquee(){4 X1 c, Z1 V$ w% c8 | q- x+ F3 s
if (iedom){- v( {" }0 [1 R ^; J0 e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( o, R' T% d* n6 W/ a8 u& T* Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# w, u9 ?2 u2 P4 m2 H+ L# G0 q: k7 O# J
else+ c2 I6 {9 {$ p! t# M4 A& R
cross_marquee.style.left=marqueewidth+8
; a7 @ J: N" J) S
+ Q2 L3 s, ]& N}- u. v# K( b" `5 V' Y
else if (document.layers){
% j2 O, u" g0 ~* Z7 nif (ns_marquee.left>(actualwidth*(-1)+8))0 m2 z" L8 s3 ^) G+ A4 l
ns_marquee.left-=copyspeed
% a& {& ~2 {1 J8 s0 aelse
" d( M* _7 G- x' ~0 l* |ns_marquee.left=marqueewidth+8% X! J/ w* G7 O! B$ w! O2 \
}
# u3 m$ T. }7 ?5 p, O}
" U6 T# P7 {7 S$ k/ \8 j/ Q; W; n5 n
if (iedom||document.layers){
K, g, Y0 n% s W* a) nwith (document){9 }7 h1 d1 o/ p5 b& D9 U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 o8 o2 w: J: ?5 R/ {! D
if (iedom){; {. u e0 f# p6 R5 f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 }5 ]7 F! e5 ]. }, c! V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, v& G5 X( a d' Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 F( Z" j& ?+ mwrite('</div>')( w0 Z% w( \6 k) s- _
}
8 N# c$ ?* U9 V+ P! v1 C9 pelse if (document.layers){
3 h4 H$ L5 C# [* c2 P `+ \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ a3 r% ` p) L0 m" h! Y+ Y# `5 U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' `! k. A) r4 l6 d4 C0 p
write('</ilayer>')( Y3 A0 ]4 B# a7 [! P
}- R# b; [$ D2 v
document.write('</td></table>')
3 ^$ c6 h" t2 U7 C6 F}
8 g5 S w: D a% ^. V}
' K0 |3 O0 {4 w; Y* n</script> |
|