返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, c& p: [6 F" f5 \/ M- q" H. Mvar marqueewidth=300
/ O4 g. L) q5 j' w! g//高度6 u; g* B' d, a$ o( M# m  L  p
var marqueeheight=25
9 u. m! ~; U/ L% L- g% `//速度(1-10)
8 r1 o& T) _' B  P7 Lvar marqueespeed=3
4 v4 X+ [8 o# c4 _  v; e, w# i$ q8 M//背景颜色
2 j* D* m" v4 \1 n4 r5 xvar marqueebgcolor="#FFFFFF": v6 I/ P7 S$ ~
//是否能暂停 (0=no. 1=yes)?' y" k& C% {: a9 l2 m
var pauseit=11 J% y9 K' G7 [: @1 q
8 p! C0 t- E' Q4 d8 M% _' }
//修改显示内容
) K* s! s! D" `" S* A6 pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 c. N, |2 F6 w' f6 f% x* \
4 r6 V* P& H2 A$ q& F+ V5 S. j/ I0 t) {0 n; \9 P, Z0 k
////下面不需改变////////////1 x- r7 }3 u) v1 x, A6 l1 g9 m) K
' z1 G: L+ g8 h) I' ]3 M; y
var copyspeed=marqueespeed9 D+ o' u+ }- |4 O. D& |# P. H% j
var pausespeed=(pauseit==0)? copyspeed: 0
' \- D, [8 g) |" ~: v9 f. |) w1 M' Bvar iedom=document.all||document.getElementById
$ d# V# ^5 Q# I- xif (iedom)
, j- A! U4 Y1 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* l' n: m) @  N. k/ @0 t) A$ i, p, Bvar actualwidth=''
5 P/ v6 N1 [5 G- zvar cross_marquee, ns_marquee
! J9 i3 J' [" H+ |! X$ V
; l9 G! n4 k/ [% Z3 c( i! B" _function populate(){7 C  B! w& |) w$ ~$ |
if (iedom){* S0 F' O2 W! W1 y" H5 V# U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, f; y! c8 M- ^: {- e% b
cross_marquee.style.left=marqueewidth+8
; J( v- |8 o6 c3 ycross_marquee.innerHTML=marqueecontent
8 R" g+ J( w, I% n5 ]3 z3 O& F6 h2 b7 oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" R  k0 N$ D9 S& [3 Q$ T}
' C) }1 W7 m9 D$ a% C+ [else if (document.layers){$ m1 i4 @5 X3 m1 H. w, L
ns_marquee=document.ns_marquee.document.ns_marquee25 u! c3 Z" _2 ~" {% K6 i: p  m
ns_marquee.left=marqueewidth+8: Y3 A0 J4 Q! E& l" ?- w
ns_marquee.document.write(marqueecontent)
" b8 _8 }# o8 M  c+ y( yns_marquee.document.close()
9 }  q+ z. ~# }  K8 lactualwidth=ns_marquee.document.width, ?8 H, c1 C3 l9 n3 M
}
, z4 y' w: v$ Xlefttime=setInterval("scrollmarquee()",20): Y+ ]2 Q* g; N" i8 T1 s& {( _
}
3 W' P$ U' v( j% dwindow.onload=populate
9 E5 _/ `0 x1 R9 W5 J( T* u- T* Y' v3 A" T
function scrollmarquee(){
& F% V4 i9 A0 a6 ]* ^$ r# Qif (iedom){
% D2 K9 V" @* gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% I) u- S8 A" _& f" Y, _: }
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: k* G% p% B0 v
else
6 K7 V. Z5 S6 r: Z  qcross_marquee.style.left=marqueewidth+8
; {9 \' s' ^0 ~" u9 {: d. l9 a" l/ q. F- G
}9 @6 C" i5 k% r3 X6 n3 Y& M8 ~2 c# f3 T
else if (document.layers){' [, Z$ d- K& f, [. L* k
if (ns_marquee.left>(actualwidth*(-1)+8))
0 T9 g% J; G. q1 _ns_marquee.left-=copyspeed
( C! v) m9 R4 c! _8 m8 W6 telse% j+ p/ S5 X! q: O
ns_marquee.left=marqueewidth+8
6 f# I- c2 o8 h+ c}+ {* M7 R! f9 D- E  {, A+ t  C+ b
}6 w/ N! P# ~9 D( V+ g3 T* i8 }+ G

" ?7 u/ z0 g. W4 G7 r* R. U; k9 _/ yif (iedom||document.layers){
/ K+ ]" g( y6 Z9 i& L  bwith (document){
; k" F1 K2 c9 D2 Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 W( `( j& r7 Rif (iedom){: y6 P! |6 S/ v  P8 W3 N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 y7 a( _6 L6 K; q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 y& ]$ i, N1 c' B/ i4 A: k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: Y3 G% S. \  z& ^* E9 ewrite('</div>'), o6 y; ?, _$ K0 _
}! l+ L  {6 {9 O3 e
else if (document.layers){7 O& E, K) e7 \1 t% w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% k/ W1 S" p7 S( n( `+ Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- \% b5 X) G5 k9 \. ^; u( p; b$ fwrite('</ilayer>')- O- s# D( w  o, p( f, R
}
" N+ ~. M% Z" ?/ p7 ?document.write('</td></table>')
6 u1 g/ I, R  u1 ^4 Z3 v- |}' R- B- ]9 V- e0 w5 ?
}
) u7 ~+ x( b7 G' [9 B- _0 A+ g1 c</script>

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