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

|
网页之跑马灯文字特效
//修改宽度
, P$ s7 m; c+ m& ]8 a4 wvar marqueewidth=300
4 @! p, N3 m" t S( F% f" G; _: n//高度/ D0 q3 M0 {7 B
var marqueeheight=251 C# j1 H6 l# a4 ^- ~
//速度(1-10)
" B$ k, L- y& N- |& c E! e' ]4 nvar marqueespeed=34 G9 U4 @' x- j% H/ l9 ?) O, x
//背景颜色6 a$ ^4 P3 ^" l, u' p% o
var marqueebgcolor="#FFFFFF"
% B$ r! C2 x5 Q3 D//是否能暂停 (0=no. 1=yes)?" h! t+ [9 K0 ~# n' {
var pauseit=12 b. n4 \! L, E8 J( p2 T2 y
7 k* H$ k! d& _1 g4 q/ j
//修改显示内容
" R$ s3 K+ h @. E |/ Z: ?6 u! Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 `: n* S% V8 J, i
! H& F% u3 i/ ^7 Q( V. v
/ m# N3 _& \: E1 c/ r$ X) B////下面不需改变////////////
* a3 f4 p6 F7 z: A# X6 d+ P% [% l& x( F# J. h: _
var copyspeed=marqueespeed
3 y1 V3 s. ]9 X8 u, r" s9 qvar pausespeed=(pauseit==0)? copyspeed: 0
) n" g/ l6 m2 c" }var iedom=document.all||document.getElementById
! L* N3 ?- @ m1 b0 Tif (iedom)
. P) k' [% b" D4 [; Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ v" t1 i3 _9 i2 ?% [- I
var actualwidth=''
% d/ u4 e) F0 e C; \var cross_marquee, ns_marquee
4 Y4 C# I7 s: S
2 G) A4 \; w1 P& {% x$ pfunction populate(){
1 [% F% m0 b# r zif (iedom){: B! G( y5 M& ~3 Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& Y% `8 p4 v xcross_marquee.style.left=marqueewidth+8) q+ v. i' M' L& a& V
cross_marquee.innerHTML=marqueecontent
5 r/ y/ W( B+ O% Q0 @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% w5 z: b+ u) S1 `9 D
}
' h0 a$ [+ z7 t3 x. }( Helse if (document.layers){
& I' x4 T8 A/ \8 {( `5 mns_marquee=document.ns_marquee.document.ns_marquee22 z6 o' ]0 }: H
ns_marquee.left=marqueewidth+8
: j( I. L2 I: o0 z/ lns_marquee.document.write(marqueecontent)
0 r$ g/ X( |. a( i1 ~3 v+ K' Tns_marquee.document.close()- ^; }: i0 O( [% c
actualwidth=ns_marquee.document.width: h0 \( K5 d6 i3 n
}+ A y$ w0 r2 V# k
lefttime=setInterval("scrollmarquee()",20)
" j9 f0 f+ o" S- I7 }6 d+ w; `' W}& S. Z7 G! S5 _$ K1 L( S, r0 K
window.onload=populate
$ X" B* b2 G1 v5 U% o
3 x& a- d1 `# C0 qfunction scrollmarquee(){
* D) E' T# {: F" X" Cif (iedom){
# j) ?: E( f5 a$ }. I( ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, |* \2 z$ ]7 |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# B' ?! u+ a* V
else4 W2 t: q# ?+ o; d4 L4 r
cross_marquee.style.left=marqueewidth+88 y' y, S( m6 t' s
) P+ h: F; m* r' m. P- A. ~
}) w1 v/ ~$ W0 c: A6 d# s# w6 E6 T
else if (document.layers){7 j$ O7 e$ o6 Z. {9 T; O
if (ns_marquee.left>(actualwidth*(-1)+8))
1 V9 b: E8 O% R- Nns_marquee.left-=copyspeed5 R: n; Q% d/ C" m8 C8 c+ E
else+ ?4 y1 q( B+ ~1 P0 ^9 ~3 v5 X2 r
ns_marquee.left=marqueewidth+8: `: F0 S6 F! {8 s" X
} P! S% y, O( e+ W# ]8 A
}; F5 P1 t' L( v
4 ^6 c( j0 e* e+ _: \+ @if (iedom||document.layers){) n4 X; L7 T9 D' M/ p2 L2 R
with (document){
' B' ]1 S: S# Z- ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ e4 |. K( l! m8 O' wif (iedom){
. T! U& E: P0 u" }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 M( E& U$ e/ ?% {& r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') S" I9 T# J- X& H& N8 i E3 H& w t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 U9 m2 }1 u( K( [' o+ m1 J# A( w! Uwrite('</div>')$ R U( O1 x3 p7 p& W5 |
}2 T6 h! d% \/ b* A5 \
else if (document.layers){) T4 _4 r C9 f8 Q- v6 A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ s! X3 ?9 Z/ G- r, ]. P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ J* S6 H1 L: G, ]& T' K
write('</ilayer>')
- u/ _+ l% X, {* Y) o7 f}
9 k, w! B- N' p1 fdocument.write('</td></table>')
0 }1 _3 l, j4 [" x7 g}
. G6 f" o7 Y. o}& J! E7 L2 y9 n" a. S
</script> |
|