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

|
网页之跑马灯文字特效
//修改宽度
0 f; w% h% b1 Y2 e, D: Gvar marqueewidth=300+ ?4 V& J! }- l
//高度
8 M5 g# \7 E. z4 ]' ~var marqueeheight=256 |+ k% }! O& P/ K
//速度(1-10). ]9 _! k) B% g* [/ o0 T/ q8 A' |
var marqueespeed=3, Y, l) `& [* E7 b/ [. f; E
//背景颜色
( |1 Z+ C: y8 V- b) yvar marqueebgcolor="#FFFFFF"; C% U8 F5 @( T
//是否能暂停 (0=no. 1=yes)?
, q l5 Q1 W( P1 f. Y- ?var pauseit=15 { t; Q, d: i; m1 X E
: P: `. _" x m//修改显示内容4 e% Y ^: t9 v, r% P/ `" s8 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 H$ G9 [2 Y2 v" {- p; N
! h( d! k* q4 D+ A
; A$ t9 m! Y! o. x" X5 g////下面不需改变////////////
# k. K/ O2 y8 b+ V
_, c' p& x* J6 cvar copyspeed=marqueespeed
- ~) i% F+ I1 ~5 V! z9 {" Xvar pausespeed=(pauseit==0)? copyspeed: 0
6 n2 I% ~+ u6 qvar iedom=document.all||document.getElementById' q5 z# S% f N) u$ M0 y- D
if (iedom)" @5 E# H4 U# C) @6 T. i4 M- Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% A H# \) e9 @! O( W' L F( W/ L
var actualwidth=''
4 D. y& V- C! N' ?var cross_marquee, ns_marquee
* F9 G2 i5 W3 B, V* v' d. l# m4 @* M
5 B; K- t, w% Q- H" t% T1 q6 Y, wfunction populate(){, I8 r! S0 x1 P5 e6 S, n
if (iedom){, s& G4 y/ f. m4 V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( M3 [7 Z) P' pcross_marquee.style.left=marqueewidth+83 m @, P1 o {& b0 c+ X
cross_marquee.innerHTML=marqueecontent
. I8 j5 A. ] m! k8 s8 F+ Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! n, [9 O" d: W# m, z}& w5 ?- g: _ X6 C, Z6 q
else if (document.layers){
6 r) T( z) d, r9 }; b. i. Tns_marquee=document.ns_marquee.document.ns_marquee2; l( O$ M( _' E: h9 N- w$ U2 ]( d
ns_marquee.left=marqueewidth+8
9 c) h' D) ?: v( j( f- t' w7 d8 Cns_marquee.document.write(marqueecontent)# S8 m* B# r# L$ i: X( r
ns_marquee.document.close()
: k4 C9 \+ @3 h8 `) W) _; Hactualwidth=ns_marquee.document.width
, X4 T1 t4 V' y0 \}
! i9 ?0 A- w& i* g# @; }8 f Dlefttime=setInterval("scrollmarquee()",20)
- D6 a) F( D8 p5 |3 s G}/ z" {) O; o1 \2 m# S/ h! R6 I9 N
window.onload=populate
6 q) J0 e' ?3 V) h4 F% K7 t
$ o. z3 o& x/ } Q% ?function scrollmarquee(){) B' v$ ^9 P+ c5 h$ o; V
if (iedom){
: j W" }' C1 {# M$ sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); O6 a6 d4 r' U6 [! }6 S4 d& E, `+ m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 g& R4 s# S. t# |$ j) b% R
else$ ^) y8 e4 O3 {$ @! z
cross_marquee.style.left=marqueewidth+8
4 g/ q: T8 M7 z" C
1 l, b4 A2 Q( d7 h' Q}
4 Q# `0 U5 j) T7 ]2 P2 ~2 s; h8 zelse if (document.layers){1 b) ?2 c4 O% I+ L4 y
if (ns_marquee.left>(actualwidth*(-1)+8))6 \$ j7 u/ t$ ?2 J4 \
ns_marquee.left-=copyspeed
- k# g! `* v! s: D( H6 K2 Welse
5 B: h% f" d: G, R; x2 Gns_marquee.left=marqueewidth+83 c" M; o4 b3 Q. s$ |7 w
}' z+ O" }# c) n" I
}) Y/ _6 E; O2 ~9 I' y2 J2 b. X8 i! d
+ W5 v3 ?9 q2 h- uif (iedom||document.layers){4 X1 G5 K0 \( L: V [, J
with (document){/ h1 z) U( L4 D+ O* Y: W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% {* b3 ^! R& M4 }3 V6 a) g5 L L
if (iedom){6 L' {# D2 P: q/ h, m% `" F' V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) I) F0 ?) }" bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): F( R& w1 D ]3 y6 s' _, b) h: b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ a1 H( a/ n c' P
write('</div>')" h4 L! i1 e) e5 J. s
}7 Y$ p0 U2 k& W
else if (document.layers){2 Y! n, r4 C; g3 S0 z( D- K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ A; s5 y8 B8 L* Z% ?, w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 a2 w$ i8 n; h" |. |) K
write('</ilayer>')9 J: M U2 T* A s& D, q
}
5 z) z. h: H: |3 v; A- S3 K" Xdocument.write('</td></table>')
, K3 E6 V+ }! J- J1 N: S}4 K/ o" I1 S4 F
}
" c0 H# v! [0 t- z( d</script> |
|