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

|
网页之跑马灯文字特效
//修改宽度; ]9 ^/ T; p+ {; L' R
var marqueewidth=300
6 R0 H) @8 X- T" ~5 P: Q) j//高度$ v' l% g/ B- i- | C
var marqueeheight=25
8 R' u) ^5 V1 j; a% g- |( f//速度(1-10)
/ Z) ^+ [, b! e) @) Ivar marqueespeed=3
& r }( M" h& _# ]! f//背景颜色5 w, ^+ B6 T+ U3 g: W- R |
var marqueebgcolor="#FFFFFF"
6 r) C" J- H+ P6 B, N; Z E//是否能暂停 (0=no. 1=yes)?
" r% U7 Z6 m9 S6 U1 @var pauseit=14 [4 N3 b1 q( y, n) `# S
G' E, R1 F+ l7 `5 F4 n$ L
//修改显示内容/ D/ e" ^9 g L g( l3 s6 d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
f+ I! u( W& b! }1 Z% w
) H& S: C# A/ a' i' p0 G4 Q
4 ]9 U* w3 _! H' [# k////下面不需改变////////////6 Y" u. k7 l; ]* o) ]
( S2 e, r# z/ @& F7 F
var copyspeed=marqueespeed
" h' q) v0 U# U/ }2 Yvar pausespeed=(pauseit==0)? copyspeed: 0
( y" ? X6 h; Q2 H0 r% o9 g+ g5 Gvar iedom=document.all||document.getElementById, k* D- h7 w& f+ g. u
if (iedom), m6 Y( c: R3 M4 ?4 X# W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% \9 V1 u/ S- e
var actualwidth=''
: c0 k! @3 S7 ?3 avar cross_marquee, ns_marquee5 `: q, z2 e. }8 ~; ]
# |: Z7 \& p3 e# _& Ufunction populate(){# o& ]6 r" p H9 Z. P, V; O- t
if (iedom){
! x2 C s# P7 r3 |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% l c) T# |5 d, A9 j7 w
cross_marquee.style.left=marqueewidth+8
. B& C3 Q6 l$ Mcross_marquee.innerHTML=marqueecontent; w* |7 k% B V# O3 R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ _% V- z, }" c6 k& y}6 z. G5 s* ], q: q
else if (document.layers){$ L0 [* B% {3 E4 _7 a
ns_marquee=document.ns_marquee.document.ns_marquee2
6 k t7 S5 o7 g v/ y* n4 jns_marquee.left=marqueewidth+8( O% ]3 z* J# q' o, ?" Y6 I- J
ns_marquee.document.write(marqueecontent)7 r/ e1 k" V: s- l$ N9 Y5 A' T
ns_marquee.document.close()
S0 C. D8 {( ~7 s6 y' P5 R! h9 Iactualwidth=ns_marquee.document.width
$ Y/ I/ Z% N) K6 s6 l1 q, \}
0 X+ b% U8 R$ klefttime=setInterval("scrollmarquee()",20)$ {6 Z0 b- m4 p+ P! \. B
}
! P5 u4 v/ J9 Q2 O8 A ?$ Y+ Iwindow.onload=populate
G' s4 w! X5 M( y A8 M2 G" G' P6 |
function scrollmarquee(){
0 }. d( s$ @0 N* u4 Kif (iedom){- h$ Z( l- e$ r% K& V7 `3 _( X9 w, _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). Y1 `- T" }/ P3 F7 p; S e
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# z }/ y) |1 B e$ ]
else
: E/ B. [$ @$ ~9 I2 e3 E( jcross_marquee.style.left=marqueewidth+84 i) g0 u$ R+ @- E4 N
! {3 R" |7 J* `* w
}- t( a+ ~- C" e+ s) N$ Z* M) A
else if (document.layers){7 @- B5 u0 k/ v% C8 R7 M: \
if (ns_marquee.left>(actualwidth*(-1)+8))
8 _2 n( U; c7 X8 sns_marquee.left-=copyspeed8 X! T; Y; p! m5 h$ a
else+ D. ]: q! |9 l- p
ns_marquee.left=marqueewidth+8+ {/ y4 O% u/ Z: ]6 P: e, g. o0 k0 H
} o/ |+ M( _2 N! _
}
, e2 z9 z2 Y* B" {. z# A) D8 f/ V0 P, l( I2 s: H
if (iedom||document.layers){
) N* M4 Q L7 Awith (document){: @+ W3 O6 |. Q& e- P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* t, ?" N' \1 p
if (iedom){
. q& x7 L7 u: Z! e/ R9 N% Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& ^/ v5 ` H7 Q7 j0 Y. m1 ?9 owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. `+ h+ |! l7 Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 l! M& b& O: w* o1 c% I: T
write('</div>')# k# ~" `8 [3 f# ]
}& ^: ]; Q$ p/ `% P' J7 D8 R
else if (document.layers){
9 z4 M- p: n& L9 ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! E: x6 T- h8 q5 F/ ^+ T: A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
S0 j) H+ J8 rwrite('</ilayer>')
4 ]8 F! N% \( Z8 t: ~}9 A' |, G0 _, o2 A. o2 ?, o6 z
document.write('</td></table>')
' i9 a2 d: H/ b: L}
, D) y+ L- ^- ~}
3 `$ N* k% R }% P0 e</script> |
|