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

|
网页之跑马灯文字特效
//修改宽度
# I9 b* R6 u* I5 w+ l; Gvar marqueewidth=300$ r- D% j4 s3 T0 D$ I- E; c: k
//高度
, c. S' {; a# G' E3 F* evar marqueeheight=25& s8 A8 r1 T0 ]3 ]
//速度(1-10)+ t# k) M/ d4 z, F9 R$ Z% ?: p
var marqueespeed=3- {8 q+ O8 h) o3 v/ T+ N$ q1 B% o k7 E
//背景颜色: v9 I! r+ G, G# {- F" A4 z
var marqueebgcolor="#FFFFFF"/ z$ E, g) e" r/ D' O
//是否能暂停 (0=no. 1=yes)?+ t" |1 `$ x# ^4 A
var pauseit=12 }1 Q- p H; V- v5 ^6 D
2 z/ R6 F# @# a/ Y; O+ ?- _; c//修改显示内容4 q& b4 p8 L* u: ^' o0 w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ c. m8 e$ G; ^0 n
9 o# K' h, W7 v. ^' d4 ^% [/ B
5 `1 x/ k: r1 S# V# O////下面不需改变////////////4 n' [, |+ I9 {3 x' H
: b o d, e: o8 z0 U' x6 Pvar copyspeed=marqueespeed
7 U! h+ J. S# o2 Avar pausespeed=(pauseit==0)? copyspeed: 0
+ P/ S/ I/ M7 ^' s" ?! Fvar iedom=document.all||document.getElementById2 P/ i: b8 R4 F! Y
if (iedom)& L- }% Z9 B; p! O! J; K% Q& x; B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 ?& C; T$ u7 @4 ^) \var actualwidth=''
' o$ o% e6 a5 \6 _var cross_marquee, ns_marquee. {8 t+ ~, f9 g
8 y# R. O+ t d! {function populate(){+ }5 d9 h9 t0 b& D u
if (iedom){, `: i& f5 p* L5 ]1 A5 a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" h# r. z* ^8 R1 ^$ W0 A& o* rcross_marquee.style.left=marqueewidth+83 ]9 f* K7 y, H' D
cross_marquee.innerHTML=marqueecontent
$ y6 w" [" [* h# A& {6 W9 eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- O0 R8 X/ `7 J% a5 E2 H# A9 T5 H# @}
$ j4 s, P; y; u1 u' \else if (document.layers){7 `9 ?& K) [# ~ [: _
ns_marquee=document.ns_marquee.document.ns_marquee27 `( x1 Q5 W# V* k+ O
ns_marquee.left=marqueewidth+8
$ _+ J0 n3 |- J! R7 G7 ] v) zns_marquee.document.write(marqueecontent)
: z: q( Z; V Hns_marquee.document.close()
% O; J' Y4 D) H2 l! Bactualwidth=ns_marquee.document.width
# g2 l1 [: |8 X1 L% A+ W! H}; G2 E8 u+ c% z6 w' \6 [
lefttime=setInterval("scrollmarquee()",20)
; Y- G! X, [0 r4 @" o7 U6 [}
% G2 P6 I) s0 u! B/ F0 bwindow.onload=populate
o! h3 s1 G' v" o9 e* n3 }( W+ ~( l# X
function scrollmarquee(){
2 E l9 O+ c' cif (iedom){) W m* H, H# b* T, D; |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): J3 ?! g; b; d$ \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ O( ~* Q' y/ i) i$ Y. r! G# d
else
' B1 H- m* R* ]- P: ycross_marquee.style.left=marqueewidth+8
5 A3 H/ C1 D' I0 H3 w: Y5 X v( o$ P# [0 D! l! j
}; V1 |9 ^) Q' t9 Z- W/ x9 }) ^
else if (document.layers){* f& r$ I; a% e
if (ns_marquee.left>(actualwidth*(-1)+8))
/ i& M) U4 S6 ^; {7 }4 A. \ns_marquee.left-=copyspeed8 R J/ z% P8 r; I) C$ x
else
) Q$ k# ]/ t/ I' dns_marquee.left=marqueewidth+8
0 ^4 @( i/ X' e9 Y}
9 ~. h( Q) C% w; ?4 h# L1 r2 ~}
% ]+ A5 ^$ L$ i+ L9 c2 Q
9 O: x4 Z8 I# {1 f3 l1 w* V: _if (iedom||document.layers){
2 [, j+ `8 ~5 i0 g; C4 n' c/ [% Pwith (document){9 E( K5 c: x; G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), S1 C& e6 V3 \: h' e( B8 A
if (iedom){: D; M( G* p0 h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! s! @, g9 d4 x; t( D/ `' u! h- Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! \' r8 {: H2 b3 ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 q+ K0 N! W% N! I+ C) }write('</div>'), \8 S) C) B7 T# ~/ ~: E
}! Y9 K+ i8 V3 b- y; z
else if (document.layers){" s' x/ [3 ~# R1 N" i0 v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 A6 z% `. t$ K/ f1 Z$ U0 ~& Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 @5 ^- j/ e6 d5 @write('</ilayer>')6 l$ L3 |& o, R+ b5 o6 O% O+ V {
}
! `! `' R: y$ T2 O( z2 Y; cdocument.write('</td></table>'): p- p: {. \2 y; t
}
2 u3 Y1 l; F0 z}! W/ \, n% b4 j6 A
</script> |
|