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

|
网页之跑马灯文字特效
//修改宽度 l) P' I& m9 P$ x" Q$ ]- c
var marqueewidth=300
0 r$ @- j# t0 c4 t/ V# |( W//高度
4 N0 f5 w, R% k7 Kvar marqueeheight=25
6 G5 w6 P1 |4 ?5 T: l//速度(1-10)
" X. \: H3 B6 W: y! O" Pvar marqueespeed=3
# x6 Y' D O* I6 Z4 ^& Q//背景颜色
' C& r% X8 R3 G: \! i% r1 evar marqueebgcolor="#FFFFFF"
+ c W$ K' z7 @/ w/ @" W) \//是否能暂停 (0=no. 1=yes)?
; K3 N4 Z" G' [% U* D4 c: k& Uvar pauseit=1
4 q( C7 P2 o9 T% S, Q, h
' h5 H. ~0 Q; P* H, g3 Q//修改显示内容
, R$ B; G1 C+ rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% `6 {$ x3 G" A0 y/ J8 `. h5 u6 d' X& T7 z7 m
8 r% B! l) ^! q; e+ V7 h: y
////下面不需改变////////////& t+ h. m2 j0 `) b% K
, H0 D5 l+ j- ~6 V: H8 {
var copyspeed=marqueespeed H' t& C' q7 T+ [3 o9 o. t; a
var pausespeed=(pauseit==0)? copyspeed: 0
- \% p4 X' H5 Y0 t, gvar iedom=document.all||document.getElementById( y% o6 ^* W2 w/ q; z3 F
if (iedom)
2 Z9 i p# r; q# jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 f5 M6 i& v& ]& j! b! X$ \var actualwidth=''0 w# s# k1 q/ P I0 r) o* l* q0 x; @
var cross_marquee, ns_marquee* D' [& `/ I* c. A
/ I& O' |' G5 X/ yfunction populate(){6 L6 _9 a9 y% b2 A" f, B
if (iedom){
3 B: k! t9 d2 M- u1 [1 Z; S+ T* pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! n, O! J9 Y. \; c+ \cross_marquee.style.left=marqueewidth+83 E7 s3 y3 e- z$ q, U& l
cross_marquee.innerHTML=marqueecontent4 } p7 }; x% J* F# M9 o1 `2 m4 j4 |$ o
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 o; J. ^9 e+ ]. c/ b: h- l1 g}
, p+ O! G) Q( i) eelse if (document.layers){ }0 j) ^, s O) H6 Z* K7 c/ J0 g
ns_marquee=document.ns_marquee.document.ns_marquee27 P0 K, P2 p* @; Y, l V' ^ ^
ns_marquee.left=marqueewidth+8
8 D% h3 I& ]0 g( qns_marquee.document.write(marqueecontent)
1 m1 Q4 \' S6 y9 cns_marquee.document.close(), @/ {: V1 F+ ?0 ~
actualwidth=ns_marquee.document.width) p2 `5 l9 A4 x ~
}
3 t$ ~8 s" j: K* [) |. Llefttime=setInterval("scrollmarquee()",20)
. O, D6 U; S. U}
7 `" q- |3 A5 S) ?window.onload=populate0 G% P1 }' A; g- j& u( c
: u( ], \/ c; A+ T" Z
function scrollmarquee(){) c9 j2 T2 j/ d/ ^6 @
if (iedom){
" h$ F, M$ ~. U6 M2 {+ q/ i. Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: o! H, O. M! Z7 m: Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 q6 N% e2 y+ d% ?. f9 N
else6 f6 C/ [' S! c6 M
cross_marquee.style.left=marqueewidth+8
' [; \; w$ Z) E6 Q5 d' X5 Q1 D7 B8 j0 A$ x6 {
}! V l4 x4 A5 z9 K1 i, C
else if (document.layers){
9 ]! u g p1 s/ ]$ V ]if (ns_marquee.left>(actualwidth*(-1)+8))1 o0 O' G# ?! Y, l( Q- p
ns_marquee.left-=copyspeed
2 E* C* W+ v/ A: T( Velse
. n3 h8 D$ U. M& C8 Vns_marquee.left=marqueewidth+8
/ g" d5 w) u$ `9 ]& N}5 e* r- g; G. b# B7 e( ^
}# b3 r# t7 z! |# ^" d
7 V$ O, v q. R" d3 } V
if (iedom||document.layers){
4 ]4 U7 R8 d$ k& u" ^4 `6 Jwith (document){* x2 _% Y% n: V2 S6 H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 f1 T s6 c5 X! k9 vif (iedom){
2 G/ [# M" C) m% i3 O Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& j4 \) O' V5 h' w8 n0 B5 ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& ~1 j {3 ?0 L* l* k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 k& v% k; C6 S/ P4 H' c& Twrite('</div>')
, ?6 v" q9 A4 L, g. l: B}
1 [9 L' S* b* h! {. y' B$ welse if (document.layers){2 {% K+ w9 N" L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 f5 j5 I2 E; q$ D, Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- X9 a1 G8 ~+ z
write('</ilayer>'). X" g# d) l7 x: ?' H
}
1 A3 A; y& d+ | o& vdocument.write('</td></table>')/ A( S$ B: p0 u; Q) m
}& E# u5 o/ q" }7 Y/ Z" s
}
4 d' Z: M3 j8 ?" D) z. u</script> |
|