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

|
网页之跑马灯文字特效
//修改宽度0 `, j1 b' J. X9 _8 z
var marqueewidth=300
: z8 M: s$ Z/ t, R$ N4 s//高度
% F( w( ?3 P$ C3 c) x2 {( e4 }var marqueeheight=25
1 |, f2 b5 G) P% r2 p: C; O//速度(1-10)$ V/ s6 G0 @* Y- L3 g) V
var marqueespeed=3, E8 x( {6 o) P/ i: E
//背景颜色
; B) a8 |1 R' i3 ~/ j' P! pvar marqueebgcolor="#FFFFFF"/ }: n$ V" q t' {/ S
//是否能暂停 (0=no. 1=yes)?1 c- r+ {! [6 N4 |1 G( z3 a6 d
var pauseit=17 \4 f& K J/ S
1 @- i. V' m# ^) c. ~//修改显示内容
5 d% p* @/ G) Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& @! N1 x& M' E2 T/ |; P& O6 |( N2 r9 t1 ?5 V6 D, Y/ c& c- t7 h7 j
( a4 }6 [9 V: I3 ], D////下面不需改变////////////
# l+ \: S( p* m! \4 }( h! I' ~+ B6 g! e+ G* W9 [8 ]% \
var copyspeed=marqueespeed: S% Q! \- Y$ x* y
var pausespeed=(pauseit==0)? copyspeed: 0
5 `# L( T! w5 u9 \var iedom=document.all||document.getElementById) g3 j- `- ]) z
if (iedom). H' v- u# `: B5 Y i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 g/ b! b8 Q, Q
var actualwidth=''/ Q+ e9 I) m+ h. D: ^
var cross_marquee, ns_marquee8 l. J( w- y$ ~* v
# j9 O/ {+ r+ }& y, v: j( nfunction populate(){* t1 j) a. {" f4 d h" m0 S2 K
if (iedom){
! G/ R3 W, X4 W; v" O6 Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 ^2 s, _1 B, }7 S& L! x- n# K* qcross_marquee.style.left=marqueewidth+8
' @; K+ N, P( F. _1 M- @cross_marquee.innerHTML=marqueecontent
* h, W+ Z5 _: N- _7 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! c8 c' ?9 a2 I c
}
2 ~" a( X8 Y9 ?8 w, velse if (document.layers){
/ l4 Y6 h* ]( g4 a! Nns_marquee=document.ns_marquee.document.ns_marquee2
0 A h# ], l4 ?( Y0 lns_marquee.left=marqueewidth+85 |: w! W7 K' V; T
ns_marquee.document.write(marqueecontent)
4 ]- }0 [% B* K! O2 U B' Wns_marquee.document.close()
0 b* k4 B1 b- }) _0 h5 K1 y# Xactualwidth=ns_marquee.document.width' b' {3 ?6 L8 m% _
}
5 Y/ ^: W: J& Q& J. \) g9 Ylefttime=setInterval("scrollmarquee()",20)
3 X; N6 f$ o9 d/ e}
5 y5 A: a- j% p$ s) a3 _! n" D( T/ Bwindow.onload=populate6 v# U9 c* e8 H
4 `( j( G# X2 D( S) e% Wfunction scrollmarquee(){
5 V+ ?1 M8 U: l/ D6 n, U& qif (iedom){# ?# x4 E6 i- Z) j4 n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& l8 R) S9 E+ j1 z0 g" l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 ?$ k; x% Z& f. V/ A& K8 f- Kelse
. s4 G5 M6 w+ |: @5 Jcross_marquee.style.left=marqueewidth+8
! I( q- j2 V8 U5 E+ w! @9 N! p8 e, \8 B
}; ^6 k6 q3 j8 ~$ h Z4 f" Q
else if (document.layers){- _( a; x3 {+ {# a2 q) @
if (ns_marquee.left>(actualwidth*(-1)+8)), S$ V! P, J) Y% Q
ns_marquee.left-=copyspeed/ p! r* g" b; a4 f0 W
else
1 R3 s7 z2 u" C' i+ _3 G& Xns_marquee.left=marqueewidth+8
2 I/ z1 C# z& q8 o6 k0 y: B}; F7 P- B" o" M! b% O6 H2 R
}( W& u, o8 ^# C4 b. O$ q
& u2 x! g1 ]/ Y. V9 E
if (iedom||document.layers){
0 c; y" Z6 @+ j) j4 C$ u: ~9 [with (document){
8 W" X4 ?8 Z. { Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' P/ [9 z+ N; i
if (iedom){- Q" k$ p2 y3 ]6 T1 R6 l
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 K6 S0 j" O( u7 F) Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): j8 C7 y9 c: T! P, f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): t5 m7 O* F1 w$ d% S
write('</div>')7 `: `5 P6 i' x, \2 }9 a: J
}
" e* I' F6 k3 Oelse if (document.layers){4 s$ B B( M ~# @% {- J( T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); q% H7 G3 G: e8 L9 D- N) ]' \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 B4 f: b; t( v# `% L" H, swrite('</ilayer>')
8 w$ K/ E' ~1 V}
% d; N% h. [. D$ ~2 Hdocument.write('</td></table>'), ^$ }; }* [) d8 P
}
& c2 i: V/ r. g" b+ u8 A4 a}
, v& N! i g5 j4 k2 m" J x</script> |
|