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

|
网页之跑马灯文字特效
//修改宽度+ r2 G; U6 P; N; M; l: _9 B
var marqueewidth=300
' i3 g: |1 A& \//高度+ o9 u" r O6 i
var marqueeheight=25
! m% d& m( t0 |# a0 u//速度(1-10)& F1 t& |: g7 v! ?! e
var marqueespeed=3
. Y: V* j+ s$ f. T( q9 S) M//背景颜色
a7 M$ L( ^5 c& v# y8 t" Nvar marqueebgcolor="#FFFFFF"0 l9 t2 [5 t: h$ e- s/ H, N% w
//是否能暂停 (0=no. 1=yes)?' m4 ^# o& q5 W
var pauseit=14 S0 X8 S- Q+ O* E5 K9 d9 I8 E- Z
' `' l" r+ j2 n) ~! y//修改显示内容
% I! o: n! t0 I" a+ |1 T; Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 m2 B: L# Q; P. c3 c0 E* }3 Y. Y
5 O% d$ e4 X! [1 n( p
1 M) G% `) W* K7 K) x+ Z9 m# C
////下面不需改变////////////" k ?5 f; U- K0 T7 x! g- @ A
& ^6 ~. \7 y6 }
var copyspeed=marqueespeed
6 ~* `1 w0 R, ?" k5 Wvar pausespeed=(pauseit==0)? copyspeed: 0& i4 S+ x6 ~: J) J7 U. }
var iedom=document.all||document.getElementById
( M3 t" M' e* z2 J6 x! j( w/ yif (iedom); r& x5 E( T6 K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- X; O4 Z" |- I! mvar actualwidth=''
4 Z; _5 {$ v4 Y" B/ X1 @var cross_marquee, ns_marquee
$ M% e H7 f) P" n6 n3 j% ~9 Q% i7 M- v: z$ Q( F
function populate(){3 S# b% a7 K& t ^
if (iedom){
: N, C2 C( i" Y* \2 ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ x0 f& A0 C: _ |7 m
cross_marquee.style.left=marqueewidth+8. g9 I8 b0 N6 t! y, i, ]
cross_marquee.innerHTML=marqueecontent
; O( w% x! ~$ |5 U! X9 w) O1 s: K2 Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 }( ^" g. S2 |}% }# c. c! X8 t, F
else if (document.layers){) F) b0 w+ _: b- ^
ns_marquee=document.ns_marquee.document.ns_marquee22 c( A9 V7 F( a0 j4 f
ns_marquee.left=marqueewidth+8% s/ ]$ c6 K# h% O9 i. P
ns_marquee.document.write(marqueecontent)1 E6 r, s R: ^, T3 @
ns_marquee.document.close()
! \$ | I. P y) e% Xactualwidth=ns_marquee.document.width
) T: y1 h5 g8 I+ X. @6 L& d& R}
& d/ n: y' {" Y2 r' E9 rlefttime=setInterval("scrollmarquee()",20)/ }( |4 I, w! N$ R) Q# G
}
: }. N: j! N, K0 N" @window.onload=populate$ q( b$ d; O P6 |
7 G" b) h6 Y2 ?# c J6 G
function scrollmarquee(){
$ p5 ?& P- f: z+ L" Oif (iedom){
) q. Y8 J) _5 F& q; Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. |# P% }$ H9 gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 i. }5 Q8 [) s/ j; v1 ]- eelse/ h8 O3 u6 {3 l6 r4 f4 i. y
cross_marquee.style.left=marqueewidth+80 t) u/ \# I# C# H
. \5 h& u7 R" y- N* P4 _7 A" S
}4 b# u- C6 T+ m5 V" P# \( O9 p
else if (document.layers){
3 K, H; p4 x" R2 qif (ns_marquee.left>(actualwidth*(-1)+8))
. k% E1 v6 _) @. A3 l' F2 Fns_marquee.left-=copyspeed
% L) T/ V3 G' W/ `else4 A' Z k7 F2 }' O" Q* P
ns_marquee.left=marqueewidth+8; W( y9 x2 O2 C2 ]% N* |# k
}
& K' s& J4 O# _: p9 O8 ]5 v}1 T6 ]- T! H1 B1 ?/ c
2 D: S% K7 O4 W
if (iedom||document.layers){
' k% w; p& |/ Q* Z+ Z/ s3 @* Dwith (document){8 N5 n) R' L# i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" B8 R( @; x, w8 _3 o$ `2 v# j x& o
if (iedom){
8 D8 Y5 v' G6 `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" a6 J/ k# r; @* R* I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 Y0 T# v' n6 `7 i' t* c: s3 Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" G; G# w' ~5 V5 }write('</div>')
9 A7 E! Y6 X R D+ V' r}; r% [7 x& A: t- i/ }6 ^% B8 j* q; Z
else if (document.layers){) l, X+ r. }7 c- O/ H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% q% \' l, ^* t- p# c. [8 l+ {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
P8 s- R& z% q! f$ Ywrite('</ilayer>')
: v0 c2 P' C% P* F! v A5 y}- [7 ?# U) L9 m l' a; P
document.write('</td></table>')
( ~: L5 V( T# h8 e7 x W}3 u Y/ s4 J7 C" D
}
& L/ S* {; K# k( m</script> |
|