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

|
网页之跑马灯文字特效
//修改宽度: p3 h' ^, Q8 q# e- W- a; B
var marqueewidth=300* C8 o& g" N. [2 F" _$ b4 H% I
//高度) K' Q! g8 c { i7 S1 K
var marqueeheight=25% J. p- p' Q2 Y. p0 M2 d
//速度(1-10)
$ b, M8 ~9 O0 T( c. g6 A; ivar marqueespeed=3
, W" O/ k' }/ C//背景颜色5 S4 S! g7 t+ z4 N5 J; E
var marqueebgcolor="#FFFFFF", [7 P* X! l# }! N8 I
//是否能暂停 (0=no. 1=yes)?* \# z+ I7 ^7 Y" @- [ x
var pauseit=18 K* ~- V* |* l A6 c- b" ?
: s1 U3 [! T0 y) d9 u//修改显示内容; T9 h' q4 F: Q3 K! G& L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 K- t8 }! j* X1 m% ?
. F6 Z: b' m/ p" }( _5 Y" [7 A; @! [2 m
////下面不需改变////////////; I' l O# M- }$ W3 G
0 A' }2 T. f* d
var copyspeed=marqueespeed
7 Z, a$ t" ]0 ^var pausespeed=(pauseit==0)? copyspeed: 0) f8 g, O1 G" M9 v! A2 u, D
var iedom=document.all||document.getElementById
' I( ~& C8 w* C/ ]if (iedom): ^$ q! n. a: h0 q8 [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); s7 S6 h- h- U: H F" H
var actualwidth=''7 |1 ?) s0 `3 [
var cross_marquee, ns_marquee, D! n$ b. M6 `1 }9 n
6 L" O, q) j/ _* I9 Tfunction populate(){
% m2 O, k3 n& xif (iedom){6 _. v3 ^3 p) M( P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 ~: y9 I* G) k. o1 G4 ~2 R
cross_marquee.style.left=marqueewidth+8
( S, Q/ R6 u% ]0 p: I" M" xcross_marquee.innerHTML=marqueecontent% q% C& g$ g3 t$ y/ l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) R1 V( |9 T* S1 }) f}
, _$ R& V5 d8 c4 Pelse if (document.layers){
! Q/ I) H6 }# v' _4 yns_marquee=document.ns_marquee.document.ns_marquee2
. F& {( k5 T( Gns_marquee.left=marqueewidth+82 w" R& T0 A7 S( T: |/ `% f8 o
ns_marquee.document.write(marqueecontent)$ ^( x! ]* l2 L
ns_marquee.document.close()
9 E' N# ~/ F) p3 Z- E" \7 ~actualwidth=ns_marquee.document.width
2 P2 ^ H# b7 c, Q9 o}1 q7 C2 C6 ]$ H- B- K7 \
lefttime=setInterval("scrollmarquee()",20)( o! |) V& ~+ d& g/ h; q
}) H$ O" b- x& u* _
window.onload=populate
; n6 ^, x2 |7 a- k" J% g1 r g9 C0 t
function scrollmarquee(){3 o, _5 }' }8 A1 n. M9 t5 J# i
if (iedom){; z. l/ ^+ s4 z- ?! F* S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& |5 _0 }3 X4 ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 ^# u( H, G8 q4 J( P, f
else
' l/ y1 k; H' g/ B7 C& Mcross_marquee.style.left=marqueewidth+8
+ l5 _0 m7 l; X, h( b% {* J& B% e" X0 D6 N7 g
}1 x5 g# ^' ]6 ]1 I% Y; b2 b% @
else if (document.layers){
( d+ ]* x/ A, X m$ U9 Yif (ns_marquee.left>(actualwidth*(-1)+8)). Z# {$ j$ k" b: i. N' y: u
ns_marquee.left-=copyspeed/ @0 b" r; t: n' F
else
" A3 q9 |) N, @ns_marquee.left=marqueewidth+8% Z0 z3 z2 r b9 ?
}
2 e- ~6 v4 v, M& ~}
8 O# Q& p8 ^+ Y( V9 d
! @6 M# Y- j* R4 }, ~8 [4 I5 xif (iedom||document.layers){, ^% }0 A6 @9 s( P7 n
with (document){5 ~" ?8 C: w# ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 \2 Y2 t% T8 M! J7 v
if (iedom){0 P) D) p2 O# C; o% f B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') N( f9 G% ?9 i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 B2 s" J9 ~* h! ~, o" E+ N
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- F @: `; ?' ?+ nwrite('</div>')
2 N# @5 e; v! Q2 ~5 E}) i( H* _5 `* X' j0 ]8 m- S+ h
else if (document.layers){1 c3 I5 I0 g7 Q) _- n' I1 ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 L3 ]1 \5 H) o3 D6 {' L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% T( Z# J* ^, j+ a: vwrite('</ilayer>')
) W# z, j z3 Y}; U; ~: ~# w# A- `9 b r+ B
document.write('</td></table>')( {$ @* }" B6 [) j
}; k# {+ r, \; H$ U* k$ B
}( T7 [" x9 C2 l6 q
</script> |
|