返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ Y6 r9 R- @4 d& @/ ovar marqueewidth=300" r# H3 F8 B2 T0 O2 y: A$ i3 z
//高度$ F! @2 N/ j+ ~( U: S! N% F1 v
var marqueeheight=25
1 Y+ {$ [4 ^0 J- C//速度(1-10)* U3 o6 o5 A! F
var marqueespeed=3& l; x* Y7 A! U0 w4 G; x
//背景颜色
7 X5 _5 s4 W* E' }5 t, h& s, Kvar marqueebgcolor="#FFFFFF"
% O# B' r3 T7 L0 b, i+ M//是否能暂停 (0=no. 1=yes)?  G& h5 D) g" M
var pauseit=1% k9 S# i! n6 @7 a7 `7 z

2 v6 L" k2 R4 s0 j//修改显示内容
% r( w) O, `( u2 Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ A! o# z5 V: |! y- |' {7 k, b% P- _& r$ w4 T  j

! |# j0 d& k" L. g////下面不需改变////////////
8 P/ A! }& R- D( |7 _  R# E% s" R1 }! X0 V; D3 ]% t
var copyspeed=marqueespeed
; r) |! W4 ?4 K2 }" N: }8 {+ Bvar pausespeed=(pauseit==0)? copyspeed: 0
4 e" R0 X) J! L; w: t# w0 O, B+ w+ Rvar iedom=document.all||document.getElementById5 L% _, C: g/ p
if (iedom)
# l9 K# M: o" f; n# t8 k( t( Z8 u9 Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 F8 m$ U5 Q+ ?
var actualwidth=''
& Y$ {- J4 M! i  i+ Tvar cross_marquee, ns_marquee$ i3 ?1 p& E- E' t% T5 r

" Y7 i# Z) X1 F$ _8 |& I9 y! Dfunction populate(){5 X/ @$ t$ t% L/ ^" |+ L" c
if (iedom){4 T! G8 G, ]% U& Z2 F% @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: W$ \0 R$ ?1 J8 j" T. i% U4 kcross_marquee.style.left=marqueewidth+84 Y: l) ~1 n0 T8 ]
cross_marquee.innerHTML=marqueecontent2 E$ H9 S+ \. H( f$ S( L2 ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( d) [3 s, w" ?0 }5 |
}
) I/ X4 q  O* O- H2 Q0 h9 Xelse if (document.layers){5 r; f8 ?" k' x' A; L; D9 o
ns_marquee=document.ns_marquee.document.ns_marquee2
$ W1 a- }; }, ~ns_marquee.left=marqueewidth+8/ v; V8 x2 Y5 a: }. v! `( ~
ns_marquee.document.write(marqueecontent)
4 p( Z5 k# Y1 O% Q: R- `5 yns_marquee.document.close()1 ]+ J( _, h1 B/ p' `- C
actualwidth=ns_marquee.document.width
1 b  P- Q6 l; y}
! v2 F. e! R6 k1 G3 P+ \% Hlefttime=setInterval("scrollmarquee()",20)
) l- o. }, E6 _  P/ M5 T9 D6 u}
  f9 Z/ M2 @( ^% z: ]- _8 q0 O2 wwindow.onload=populate
+ ?) g7 v1 V) X
4 @& V+ p- t6 @9 X2 z: l, Y) Qfunction scrollmarquee(){# ]& T) A* ?4 }' t& m, X; \" R
if (iedom){
) g: y  n% ?0 }, q0 ]9 m. Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: N3 b: ]0 J5 Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ o) J* s4 E* e0 O+ D
else9 P" [$ Z0 n4 n
cross_marquee.style.left=marqueewidth+8
* s9 D% o  C7 x! J" A4 H
& V$ a9 \0 J9 y& a8 c}
9 h+ _1 @% T1 xelse if (document.layers){
! X0 k3 O) E/ ?$ O9 s0 {- Z$ Bif (ns_marquee.left>(actualwidth*(-1)+8))4 a5 L. J& o4 q; R& C
ns_marquee.left-=copyspeed  g8 y( _) z  v1 V
else% c# u% q/ O; [6 ]/ {
ns_marquee.left=marqueewidth+8
% U' _% l. ?- Z( M# V7 ^5 O$ J}
- S" P, P- Q- X9 F}
8 n# e/ S1 X" S1 L% [( W$ u8 [  M2 X3 e7 T" c' k8 I/ r* e8 ]
if (iedom||document.layers){
# d8 i2 L# B8 Q) j& ?4 ]2 Mwith (document){7 j  W" `0 O- \2 c+ x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& U7 u& F1 D+ p% F' i+ v1 Y- R  L
if (iedom){
* c- P0 E: R, ?1 t& Z8 y# K* n# Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ g2 x2 P) h. g6 Q0 Q# j/ cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ E* `- I2 ~) T& s2 hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. o9 ]0 G7 g5 c1 A+ g5 X) xwrite('</div>')
9 Q5 B. o  B1 O$ p}
; J, ?/ H: E! K! V0 Melse if (document.layers){
( p, t' j9 x( G0 Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 Q5 l  |- Z0 Y5 j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 u3 n5 X' z; j; G+ i$ J1 }
write('</ilayer>')$ k4 O9 z- J2 I1 b# ^& s7 t, ]) O
}( H; c+ v. B5 d
document.write('</td></table>')- m1 w* C+ q  A2 Y& G( s
}
$ s, ~  }* `) }- U, a}1 d' `; l# Y9 l, M
</script>

返回列表
【捌玖网络】已经运行: