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

|
网页之跑马灯文字特效
//修改宽度
3 f% w8 j5 Y: p& d" _" _var marqueewidth=300
' }4 r& J$ F8 n' Y5 |9 D$ ^% e//高度! t6 m7 F; x) k* A
var marqueeheight=25
, E! {) u) l% f6 @, m7 H//速度(1-10)
# B; n( w, f, o0 ]/ lvar marqueespeed=32 c6 l& [% l+ M; Q, B0 [
//背景颜色
, b, U( u% F7 ]0 k! \var marqueebgcolor="#FFFFFF"
% B% ^8 H3 b: g m//是否能暂停 (0=no. 1=yes)?' p5 D- @: K1 T
var pauseit=1
: a: ? P4 H! d/ p, T' W3 C4 B0 X2 `/ {3 E
//修改显示内容8 d3 y3 J3 t; |% j E) R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# L" J" r) i3 j8 r
5 A9 q; v. f# D4 r! J& h4 O- ~+ B% o( N1 P6 f3 O o3 E
////下面不需改变////////////
) x( U; b$ ^. v4 ?. s6 s: y
s2 ~6 ]# M/ R4 |$ z/ s8 m! M+ Rvar copyspeed=marqueespeed
3 r6 m5 L# X! kvar pausespeed=(pauseit==0)? copyspeed: 0
2 F1 _, ?7 X: V* K1 w- mvar iedom=document.all||document.getElementById
1 D% O" _$ W+ D9 g, h, l7 Y6 n! Fif (iedom)
; p: K- d o3 H: V6 c: Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; }/ z( ^0 j: q2 J- O5 ^3 ~2 Q- Zvar actualwidth=''0 I3 c0 Z' Q$ L
var cross_marquee, ns_marquee t5 y, ^% {' v0 L8 l. {
4 Q8 K# X* P' ~# I; S9 qfunction populate(){
/ ~5 S) u% V/ P) lif (iedom){6 d( T! ^" R" M$ |# ~) B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 q+ Q4 b/ u" U5 f! j
cross_marquee.style.left=marqueewidth+8
* T2 C# m4 d% q+ |cross_marquee.innerHTML=marqueecontent; I( K& Z6 R' m! r- F( k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 q% q- P6 ?# {7 B! m1 P1 u}
! W( a* N4 y& M5 E3 R: a" y% C( O: Melse if (document.layers){
% S& ?2 ~. l3 f8 @) r3 F2 vns_marquee=document.ns_marquee.document.ns_marquee2
9 R1 a2 v/ C+ g9 h+ o4 a: V( C7 xns_marquee.left=marqueewidth+8
: f/ j3 [6 O" E p5 x$ @; B) z3 Gns_marquee.document.write(marqueecontent)
5 {8 Q% D A' R' p7 d) uns_marquee.document.close()+ B5 R- ~1 D- z: h; U
actualwidth=ns_marquee.document.width( W& {' J' h# u' j: E
}5 [! d+ ~( b4 b
lefttime=setInterval("scrollmarquee()",20)
) p9 C, o6 Q! t/ R9 ~}
7 p1 d% Q! f- Z' nwindow.onload=populate
% m" R; {9 o4 K) |8 d' s+ a5 @: q4 A: ?. y0 t8 |% g
function scrollmarquee(){
6 v: J" c9 N4 Z2 Sif (iedom){% R0 c+ F y3 Y& U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 t( H9 K0 ?) E0 Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 Q E- l0 n8 V/ Ielse, Y1 O+ l9 J3 s$ s2 E
cross_marquee.style.left=marqueewidth+8% S2 }9 O) N2 V, |& }: R- v
2 ^4 O. t$ p7 M+ Q7 `3 q+ S
}4 T7 y0 D! T# k4 |5 u% r3 ^
else if (document.layers){9 M& F% A5 C2 s& @4 c
if (ns_marquee.left>(actualwidth*(-1)+8))
3 k( o+ P$ m$ r7 n# g/ q# {' Ens_marquee.left-=copyspeed
8 H8 Q% M M5 D) Z2 \5 Welse6 I! ?' l' p& _* j( G9 }
ns_marquee.left=marqueewidth+8& \- b+ ^! [9 @2 ?6 P1 G6 K' y
}/ z5 N, _" ]$ H; ?0 K7 ?' {
}' l% D( b, A6 d( g1 p& l# C4 y- g7 Q6 Q
: ]3 m* F7 a: a# r4 Y' A: Iif (iedom||document.layers){
. f3 I- Y" r6 c( bwith (document){
9 r# r9 ?3 C3 O [ W; J+ udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* G* D% m# j1 ^4 X4 v2 \if (iedom){
7 A3 ^8 g/ T7 R+ O/ _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% \& j1 e1 p( x' Z( r0 {+ f8 Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# D4 M2 f$ V5 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( i; a6 o2 |! z6 Z! \$ k/ rwrite('</div>')3 S" ]2 B6 S/ n! R0 a, `
}
, r1 S% P, a+ O! b* `% f# telse if (document.layers){
6 G+ o- P. F2 s k# u" ^1 Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# @. X0 ]% Y, A2 swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ s. Y* F" Q" c/ i3 G" |" rwrite('</ilayer>'), ?8 Z) E4 c) C7 Y7 p& z w" l/ b( k
}3 c' p, Q! j x+ R' K
document.write('</td></table>')& b! p2 |3 ^! ~, |( F- J
}5 O4 r% q" x) K$ l! J: r) W- k
}' R; l: C; D5 S( x! S
</script> |
|