返回列表 发帖

网页之跑马灯文字特效

//修改宽度: `2 S6 K/ o. e1 @4 V0 g- g
var marqueewidth=300
+ B; k8 o- |" Z$ h4 f//高度  `- N, x7 b# W6 F5 P5 N: ^
var marqueeheight=25% T& Z9 l3 f6 m6 _
//速度(1-10)! E# D* z6 R5 N! G& p
var marqueespeed=3
5 J5 v# @  M6 W0 N% _//背景颜色
1 E# ^) b9 E9 L( m6 G7 @var marqueebgcolor="#FFFFFF"9 j- z0 U2 L* W: f4 d
//是否能暂停 (0=no. 1=yes)?
: M# D1 S6 |* Y/ `- @var pauseit=17 {* r) I  h- h- u1 T. \
" B/ I8 U3 `1 j" @9 w' o
//修改显示内容
" l$ Z1 d$ ?) H, Y; K( bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! e0 ]: P9 h5 R  D2 {" x1 {
6 F3 V2 ]& {( A& z" T8 E( [6 O: J$ x
////下面不需改变////////////# l0 a; E3 S% G8 Q
  ^. k- ^, j8 i, N/ I
var copyspeed=marqueespeed, ~* m, g; N4 B' w$ D
var pausespeed=(pauseit==0)? copyspeed: 0
5 O- J0 D% ?0 ~0 U3 H2 A- {( Mvar iedom=document.all||document.getElementById) \6 W. d6 U6 q. z. S% f! t
if (iedom)1 S. l' m7 p5 _: m  q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. z8 a  ~5 q8 A) @3 tvar actualwidth='': E. @- K* q% h; j8 {% L
var cross_marquee, ns_marquee( r9 G& ?+ n+ C" y3 w
! U( c1 w8 U0 N! ^, G, v' [( L3 v
function populate(){
) ?/ o' k# |) h% K4 Cif (iedom){
2 [/ |3 R: Y5 b  ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, x1 ^" W9 g, I' V$ P+ gcross_marquee.style.left=marqueewidth+89 g! `) h/ v  M2 [7 p  f: d
cross_marquee.innerHTML=marqueecontent# u: O( i5 z3 j0 R2 Z" _4 N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 }" j( N/ x) h4 K8 Z# N}
/ j$ h; U# j4 A1 u2 Nelse if (document.layers){! m, F  h4 Y# \5 ?' M. h9 P* S
ns_marquee=document.ns_marquee.document.ns_marquee2! L1 p5 ~0 S$ |" s4 _, B- k2 E
ns_marquee.left=marqueewidth+8% g( |5 q9 j/ F& b
ns_marquee.document.write(marqueecontent)
. c1 m2 g8 b3 {, h& W' ?& Ens_marquee.document.close()- z) x7 G6 q3 x" W. n( i3 E8 ^) Z
actualwidth=ns_marquee.document.width
4 U% _7 `+ d! ?( j3 T9 }  A! J}
  n- u, u' j" T+ blefttime=setInterval("scrollmarquee()",20)0 n8 H9 I7 y" i9 Y4 ]1 _, F
}
/ K! T  n0 H/ ~2 n" q2 u  I& swindow.onload=populate
. n# n. V+ c# m2 g( J
; S1 @8 j" x" V% o9 Tfunction scrollmarquee(){7 f9 q+ X% z0 `
if (iedom){
7 r& Y! ~. ]0 p; `( }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& c& C: F1 ?0 }" T5 @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 \& y: X7 w2 O5 p  Pelse
" d" H" `: S7 C! F: X7 O' ecross_marquee.style.left=marqueewidth+89 }+ j- X" f' b, W
+ ~5 k# u$ J$ \8 |) r  G
}
! O. ]$ |3 G, Melse if (document.layers){
8 U" [$ P  y2 \* sif (ns_marquee.left>(actualwidth*(-1)+8))' }% K% N! F0 w7 ~3 X* l  ?' a% T
ns_marquee.left-=copyspeed
. V, f& {$ U0 y3 h- o8 xelse+ @: A! q3 s+ C/ x0 S+ X
ns_marquee.left=marqueewidth+8/ S5 E) H2 G$ q
}
( V- S7 u0 j5 g% W' G}# E$ _: s0 M* n9 Y

1 E8 H4 ~6 ^% N* `: ~if (iedom||document.layers){" B! k$ ]3 w, |# S: ~) ?$ s
with (document){( Z2 V' c6 k8 \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( [# m. p7 m" k% i9 U6 W. uif (iedom){* U$ n1 ^! [% _9 X5 R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  Y# b! t" ]$ `# ^' y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 S! w1 _( q! Q) c: w6 i! x; G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! X, e% I5 S3 W1 T3 kwrite('</div>')$ E$ L; d0 i- {. \. u
}
9 |; N* V2 I2 w1 @else if (document.layers){" }6 l' E/ w$ B  H1 v8 I  H: @( _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( Y% d$ q1 J$ [2 ^! {& m% o, Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ c9 Y+ H- I  ewrite('</ilayer>')/ J: S. X9 U, k& c) f/ R
}
; F5 I1 R3 S* w3 u* M/ h. n- ?/ x! F8 mdocument.write('</td></table>')
6 [- _6 \; m% B# O) w. }- P}: ?$ h6 y/ g7 Q4 i1 r
}
3 m1 t0 _- e1 R, S, z, S5 Q9 \</script>

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