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

|
网页之跑马灯文字特效
//修改宽度 b9 _, A! G1 w& ?$ Z$ r
var marqueewidth=300
' A/ U9 _) O$ p `# @//高度
" v) V. y+ i1 c8 {- h' Q4 Dvar marqueeheight=251 W% v5 b9 y9 u( T1 Q
//速度(1-10)- N' N3 w5 r; u3 h" g' \
var marqueespeed=3
& T2 i, @( k y//背景颜色
: L: E; A" M" n p* Uvar marqueebgcolor="#FFFFFF"
$ i; e* m- `! {3 M' b1 j$ D//是否能暂停 (0=no. 1=yes)?2 h4 D$ A# r( g
var pauseit=1* G) c$ S* g# `# {/ U' f
u) Y3 w: S4 ^0 Q; J) ?' y0 s8 K//修改显示内容
8 f; Z3 g6 D9 t# xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ w! r9 ?) K: l5 H2 |0 P3 J7 [& X# l( n1 D7 R# w% t
W- w+ I' E4 }. \0 t; m; L
////下面不需改变////////////
) H2 V2 b! S) x; ?1 z% y1 {! W% `2 O
# i, L, ?9 V' k) k& f5 ivar copyspeed=marqueespeed5 G' P6 w% T, w$ z a$ i
var pausespeed=(pauseit==0)? copyspeed: 0/ Q9 s+ L7 M% p% U' X* a
var iedom=document.all||document.getElementById
. r3 N3 \3 d0 N( H/ Z" u' }if (iedom)
- J% J- |9 `6 a- Q1 L9 y0 {( Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! S/ c# ^2 P0 I) w6 @8 K: D
var actualwidth=''2 e! K# v) @% a, E& p
var cross_marquee, ns_marquee% s0 H+ P1 q: E7 N( w* D, V
$ |8 O4 J/ ?& L( |' }. G8 v! q8 o2 Ffunction populate(){6 T! h" }# p2 @ V7 C
if (iedom){! v' Z! j5 u1 j9 s8 L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) ~4 c! s, [& F( I2 e. [. [# V ycross_marquee.style.left=marqueewidth+8
1 X$ R" P6 e0 L. i: E) Scross_marquee.innerHTML=marqueecontent
9 a' k$ i- X/ p8 Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
v5 R: U H+ a2 b+ |}/ H2 y+ `( k* I) d" e
else if (document.layers){
9 K+ h o" z+ Gns_marquee=document.ns_marquee.document.ns_marquee2. g Q6 c0 Q! c& y% t a
ns_marquee.left=marqueewidth+8
3 `+ @: N* I) E' ]ns_marquee.document.write(marqueecontent)# E0 C( I9 i9 [" T$ R
ns_marquee.document.close()
9 Q4 f& j. J& N; F8 Q/ ?: D a' B8 ^actualwidth=ns_marquee.document.width
4 {+ ]4 H! f8 e F}
3 d/ q" U. x7 d5 @2 u9 ?* @/ xlefttime=setInterval("scrollmarquee()",20)/ q5 X2 K$ `! a7 J3 \. l' s
}
+ @# C! F% n' F+ Ewindow.onload=populate; c$ @. i. M% J& P
2 O( j! T5 g$ m+ B1 v
function scrollmarquee(){6 ]3 c; Z1 T3 ~7 a! \% M
if (iedom){
5 e& `& {( P7 n3 {& p) s" zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): m l: }: [6 \ A+ V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 Y2 i8 w- J1 } z5 uelse
$ I5 T7 H; h# }& l% bcross_marquee.style.left=marqueewidth+8' A$ A% s, r- Y: M0 n1 y) C
7 E, [3 k( x1 N9 t}" f, @9 }6 Z: E8 V
else if (document.layers){
% A( |$ k: ]# F; Vif (ns_marquee.left>(actualwidth*(-1)+8))& ]# R2 n9 b9 ?' ]
ns_marquee.left-=copyspeed
6 M# w8 j3 N$ i( s5 kelse$ Q' h! A2 i( s! h$ z' J
ns_marquee.left=marqueewidth+8! e1 G1 X, U/ j8 Y0 D
}) c9 M' C4 v3 K& W5 a
}
4 J( }5 a" P1 u# M$ D! ]# s' g3 F6 B s6 A9 ]% l4 Z6 w. I) I
if (iedom||document.layers){
. S3 c: N- x) b w* H, \0 Q% \# J% ywith (document){3 y. `( D N* F1 D# x6 I0 i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 g0 ^# F2 e% y; j) H5 G2 zif (iedom){
; A) w- d" P8 W, t; Z9 Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) b* J0 Y/ a3 s* `! K' p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 u6 W# |+ S4 k! |2 y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') `- l, }% T2 e: M
write('</div>')
3 p: j, D$ p! Y8 T& M}
) }2 @8 M5 I# z' p, i/ f9 Melse if (document.layers){
" o2 D* f9 M* R8 h/ Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) @2 Z8 Z; p6 Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& s i1 M+ S8 Y% N9 T% V0 y" A2 x
write('</ilayer>')$ F o; D( V' T, x: q
}3 h7 \# B: E1 V i C3 H% x
document.write('</td></table>')' {8 K9 I6 c' f8 X8 L
}$ ~, F9 e, g0 b/ H! Z! a" o
}
+ s$ r: R/ B6 ?2 e2 X3 j* G</script> |
|