返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 Q7 l2 p" u$ ^/ N1 h% H
var marqueewidth=300" ?, B' ?9 P# |' f4 D7 q
//高度
4 w0 ], Z( _4 i$ v" E4 Lvar marqueeheight=25
- W+ w* h* o( P( |' _6 m& E//速度(1-10)
. W* {9 @+ }8 @7 Svar marqueespeed=3
: C: i# B! z8 w3 y' B) Z8 u7 }//背景颜色/ W" y  D  d/ A6 |7 Q- s: ^
var marqueebgcolor="#FFFFFF"
" ~/ I! T2 I& a8 K6 ?& V, ?0 e//是否能暂停 (0=no. 1=yes)?5 G8 S" r- L5 r9 t3 m" \# h2 y
var pauseit=1% {( k+ P, t9 I$ i* |8 q

& S/ f' D  \# Y' T6 v. P//修改显示内容
, m+ ^, k3 _2 A: e: Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 ^; ?; b, e; n( g( _" m0 ~

- G  D" K- R9 @. x( z4 |. X, y3 Q6 p( \5 h, b0 B  a
////下面不需改变////////////4 w' M% o8 e+ |$ T0 a
) J  C. B0 i+ V: p' O5 b6 O9 j
var copyspeed=marqueespeed9 Q1 f5 D  Q& D/ Z
var pausespeed=(pauseit==0)? copyspeed: 0
4 F( l% x! ?; _0 }9 M6 gvar iedom=document.all||document.getElementById
; W' s  q! W  F. J2 ], Y( ?) j9 Qif (iedom)
8 y. m, O, \! Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, Q! N1 `; B" K; [( \$ T" cvar actualwidth=''" {3 S' E1 W; J8 m6 F5 ]5 Z4 _
var cross_marquee, ns_marquee1 h' V- R6 B$ E, C+ |2 V3 Q
3 \+ [8 U7 ~, ]- r* E! T; [2 b
function populate(){
0 m7 g/ v2 {- Q& X8 q0 S" o: ~if (iedom){
; Q+ F) Y2 M+ @9 r4 Q2 S/ hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& J1 V' S8 p: C' e) z! N2 u
cross_marquee.style.left=marqueewidth+81 r. I: B+ W# K# O
cross_marquee.innerHTML=marqueecontent/ T' L  C: @# L' x% q. d+ L; G. y4 K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! H$ Y0 @! p  ?7 h' v' r
}- G% M) w) f( x
else if (document.layers){
' R+ u7 M2 c- c7 Q+ Pns_marquee=document.ns_marquee.document.ns_marquee2
# [; R. g  G. h, @7 }2 _ns_marquee.left=marqueewidth+8
! \3 t6 b: c/ C3 ?( Uns_marquee.document.write(marqueecontent)
/ Y# |( H4 x$ U4 jns_marquee.document.close()
) g/ a  n9 Y! l6 v  ~; E. F% z0 m+ xactualwidth=ns_marquee.document.width! Q( g! P( o7 T2 g/ D
}$ I$ k% j: ~0 T# j4 C5 I
lefttime=setInterval("scrollmarquee()",20)
4 o: L4 j' F) F4 j7 w2 b}
; g! n& \! Q8 G- N1 m, b4 ~( m$ a5 {& ewindow.onload=populate
+ c8 v  y7 j3 K6 Y" n  X. O
6 c; a+ `: E$ C, @function scrollmarquee(){. n' m5 g/ C6 t: \7 u, O5 ^/ B
if (iedom){$ u( Z1 d- i) ?0 g$ ]' E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 ~% L1 Y- N0 \1 e+ I( D9 wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  {8 A0 w: C9 R+ N5 ~( Qelse
  |% u2 N3 w+ ]* N' pcross_marquee.style.left=marqueewidth+8
& Y# e9 [. A1 b, N. c; ?" _, W& N7 {; u4 G  ]. o
}( O* R$ W; S" V4 q
else if (document.layers){9 J, U  Y- a+ J, B5 }1 }3 I" X
if (ns_marquee.left>(actualwidth*(-1)+8))9 v( J" l9 t+ e( C7 `
ns_marquee.left-=copyspeed
% c1 W  K4 q) e% h+ belse: n3 l5 f  c- B: e
ns_marquee.left=marqueewidth+8
# ]2 v; t7 e+ J; N& X5 P& F}3 B% s) t* K7 U: c1 Q' R% Z
}
0 e1 o1 r; A1 P( f, q3 v' _
  k/ ?& K1 m  r. W, g/ P* r2 Sif (iedom||document.layers){
( A1 L# p3 Y4 Y/ a! L# r) Fwith (document){6 U% u" K6 T; i( t/ U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 a+ Z! r7 @2 Y! mif (iedom){1 T7 u5 M* l/ z# p5 E& F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' Z: n0 Z; o, G; I; k0 ?  Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), R. Z: j3 z% M& V+ G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ C1 m# @8 h3 {$ A  a0 u- P' m3 xwrite('</div>')* U* {3 X& H2 A+ k
}
; h0 z0 K) V' o' t' ^else if (document.layers){" I' F. f, l) E8 c! m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 c9 o! ~* \& k: i$ ^
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- {( H* K3 P4 O' ]2 S0 e4 i
write('</ilayer>')- ~: w+ q# J& u3 n& b; `2 \9 a
}
# |4 r5 I2 M& [5 e- y5 a2 s- A* Idocument.write('</td></table>')
7 p! n3 p) U/ Z: [8 l/ Q}
, @  C' M# k( t6 X6 F}2 G$ G0 @* h! u. ~5 y/ j4 u
</script>

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