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

|
网页之跑马灯文字特效
//修改宽度
& L* J# s7 \6 ^; H% Avar marqueewidth=300
! q+ g# U/ b$ G' A//高度
4 j3 t, O4 e$ U I* j; d6 {var marqueeheight=25: w7 ^: ~. u3 K
//速度(1-10)( h# z [) v) m8 }
var marqueespeed=3
+ M4 f/ E( ^: n8 @//背景颜色" `5 K0 K& \1 c0 G7 S
var marqueebgcolor="#FFFFFF"
2 L" t" d! p1 D d6 \//是否能暂停 (0=no. 1=yes)?
" e' d4 G6 g X, v: X9 cvar pauseit=1
$ B; x E M' b( P) `5 {7 I
, a$ f! I- D3 Y8 G//修改显示内容
2 u6 ?! Y r/ V' N$ z: o5 zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" e# x9 H: B3 q, q4 ~% f& F
- y' x1 s @7 a5 L- _
9 j' w D' r: ?////下面不需改变////////////$ L$ h5 Z' K5 k0 B
* H5 U% S1 Z9 d" y: b* E
var copyspeed=marqueespeed; Z+ R9 i# z3 Z+ O
var pausespeed=(pauseit==0)? copyspeed: 0
; r4 U3 R" \7 I! R- v; O& mvar iedom=document.all||document.getElementById' i7 O; Q' ]9 H: L! f7 I
if (iedom)
2 I) C7 U3 z* H' {" b4 K' x Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 w) o0 l' ~+ E2 b- Y6 k, ?var actualwidth=''
4 ^$ s% m5 A. z. U$ O% Hvar cross_marquee, ns_marquee- p! _+ u+ C" O* c" ]# ]4 K3 z3 Z
3 A; |% R$ b2 F, l3 u% C9 A" Z' |$ |
function populate(){
$ Q1 Y3 ~5 J( t: Y7 Nif (iedom){
/ N1 L; P$ {$ m7 m$ o, Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! h+ P1 E: F6 |" |cross_marquee.style.left=marqueewidth+8$ j( h9 V8 Y8 `, U
cross_marquee.innerHTML=marqueecontent
* ~/ j2 |' C% y7 tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 q; ~# h3 u9 n3 c6 A& a& k}
2 N& ?$ y$ q- l/ [$ velse if (document.layers){
! t! V3 q4 x$ O ~1 E, B* `ns_marquee=document.ns_marquee.document.ns_marquee2, l% j6 f" M* X5 [- \- ~# o
ns_marquee.left=marqueewidth+8
1 B- o$ V9 f+ A3 F+ ]ns_marquee.document.write(marqueecontent)' p: v p! d: J1 B2 m. w
ns_marquee.document.close()3 A5 f5 Q& F) Q8 ~2 E0 @
actualwidth=ns_marquee.document.width
# J3 {4 S1 n4 m9 ?. y& T}4 A) \$ A: x' {1 l) F9 j' z
lefttime=setInterval("scrollmarquee()",20)
8 C8 E% [# |! [) W6 z( [}
, x' ^; _0 T9 S4 p! ` x' S- cwindow.onload=populate
|4 L6 ]0 D4 g/ _ d1 ]/ e! L7 B/ P% b4 ?$ k9 M
function scrollmarquee(){6 P7 a) `# E d5 J
if (iedom){, K; v5 @$ G& |' A% b: m! i7 w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 D+ n2 t: B% A* W0 {3 g3 [1 X4 i& q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! ]# k: E9 k7 l/ ^2 J; Aelse! y* s# u* ^2 a% o! f
cross_marquee.style.left=marqueewidth+8
, H* `+ ~, T% k5 [2 [! q7 A2 D2 ~, c$ t7 D4 i* U. g
}: l: K1 Y' [" h& ]
else if (document.layers){
8 w/ l% B; c' {3 v5 c! bif (ns_marquee.left>(actualwidth*(-1)+8))- n1 a3 ]7 y, ^& A
ns_marquee.left-=copyspeed# a h9 U& g' I9 W9 r
else1 b9 h) ~# O2 F% ?" y
ns_marquee.left=marqueewidth+86 s4 `; s3 S. ] ~% ]- {7 m' A0 R
}( K/ K, k8 i- |# H) r6 ]
}$ K; N h( ~1 ?) F
6 K4 ]' ]) }0 }) i- H, O9 }9 t* ]% B- W
if (iedom||document.layers){9 @3 {4 {) D# c
with (document){
+ x- m) I7 I7 X% m# x6 Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! z/ ?- m5 [5 R8 x. X0 o9 u1 Qif (iedom){! W+ O7 y) v9 Y, {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 H* |& f# X# r9 Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 `7 w6 o S, t* h- V: N" H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 I/ a8 Y; |1 K) R2 G; Fwrite('</div>')# Q+ |& k- l. m b% c
}
+ t8 D3 K' z9 v3 F" V1 V7 U; T7 D" Z8 ?else if (document.layers){
$ R. \8 l, Q3 y" [, g* ]( ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 _' c0 x4 v: H2 Q3 i7 @% d( U' `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); x/ n7 e) Y- Q& t7 M* W) y( c
write('</ilayer>')
1 F& d' k% ~. g% q7 W, ?2 h}1 f' Z* E3 P$ y1 q! a6 A
document.write('</td></table>')
! V+ D% x& E7 ^6 a; x* u' n}; a# n, V9 e$ k
}- _, R# w1 G" c# S
</script> |
|