返回列表 发帖

网页之跑马灯文字特效

//修改宽度: Q7 K- b8 W3 V/ r* E. o! K3 F
var marqueewidth=300- U( d3 ]; \+ \8 z+ b- b( L
//高度
- V  \+ r! h0 R8 v" Nvar marqueeheight=258 |8 C! u: W- F1 `2 R0 Z( \
//速度(1-10)
8 l: }; l+ j" C( `# s; hvar marqueespeed=3
' E: |  U: x0 g2 w//背景颜色' v3 X# r" ^6 \$ ]& ^6 W- M! T
var marqueebgcolor="#FFFFFF"
" z9 u7 j8 O+ a/ y//是否能暂停 (0=no. 1=yes)?
  N6 H4 k5 E( N; Pvar pauseit=1
! r! s6 R9 v5 N9 M( s7 Z% N/ ~
% T; w& z; F" A//修改显示内容5 v1 f( e8 P1 |. r9 C: f; t3 F$ K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 Z7 x8 @1 @/ R0 `
) A6 `9 i, c: A/ Z& Y2 Q
6 ?1 |  h9 S+ |; \
////下面不需改变////////////( @0 o( Y3 Q; J  U
6 p% [3 L; ]) ^( U: w# k6 z
var copyspeed=marqueespeed
2 J! g1 |- s, z! [) @% _var pausespeed=(pauseit==0)? copyspeed: 0
$ A- H3 ~# u( ?8 B9 F. @) Jvar iedom=document.all||document.getElementById* x0 I9 W- A: Y" k$ o
if (iedom)
, ?7 b  k2 I5 M. Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 p5 @# S% I% X9 y
var actualwidth=''
) V' A3 S; {7 v! O6 Nvar cross_marquee, ns_marquee
& Q# T6 a& J, s7 k9 e9 I
- h/ w& A+ G% P* z* _function populate(){4 G  K# k( v6 P3 j) f6 [
if (iedom){7 S8 ~' w, D  p4 }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 {  C5 S( g0 _% B- kcross_marquee.style.left=marqueewidth+8
% ?4 y  d- Z  \, m& @3 Tcross_marquee.innerHTML=marqueecontent
: C9 c3 Q6 V( X, J4 J# a' pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" r6 l$ D. S' F
}! z% M: E) A5 p' X8 f9 o4 v2 `
else if (document.layers){
7 n+ }3 t. P6 X2 h2 O( m- n8 _; Uns_marquee=document.ns_marquee.document.ns_marquee2
, O; O. `! ?0 ]) dns_marquee.left=marqueewidth+8
8 Q* o' U' i( |; hns_marquee.document.write(marqueecontent)
# e. p; s3 r: @' Gns_marquee.document.close()
' Z5 f) J* t/ `4 i6 Xactualwidth=ns_marquee.document.width
1 x) |% K0 F& b# ^: \( f$ Q6 j}1 J  {4 F# c* v1 x4 F& n+ m1 O
lefttime=setInterval("scrollmarquee()",20)- s( j0 @4 E! d- ^* Y& D, ?
}
& R* t+ l0 l8 R# F, r1 Dwindow.onload=populate  f+ z+ B4 B% s* _( i

7 P8 w8 @! j/ sfunction scrollmarquee(){
4 l: o/ j/ @% b4 fif (iedom){
7 [! H. |8 |, s3 [9 [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 l3 f( v- H& l0 P3 B1 G' fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ a4 E3 c9 I9 e  R. g% Xelse; e% Q( i! r6 N: ]- _; G
cross_marquee.style.left=marqueewidth+83 w6 k0 `, O$ W  ]5 `4 u
) ]: ^" S& j2 q7 d
}6 [/ W1 e1 p* h
else if (document.layers){
: E8 P6 r  ~9 \2 b$ M1 L0 Dif (ns_marquee.left>(actualwidth*(-1)+8))
+ E8 T; t) N% mns_marquee.left-=copyspeed! g1 C" p( w5 g4 O
else" M$ F: b2 I0 ^7 c' n
ns_marquee.left=marqueewidth+8
  a4 |+ p* q' s/ h% S9 |3 l}! B- X2 ~$ K- _3 ~9 t
}
4 b6 t' @1 ]" ]$ F
- P0 j* M' y) h" ]4 X% Aif (iedom||document.layers){
  y# v9 g4 p9 d4 B4 A6 r1 N+ Vwith (document){
6 ?/ n  @1 M( k& odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* S% a; O1 g% a# A8 J: b
if (iedom){1 A$ y) P9 \) ?) O9 w" o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* Y" }4 }+ a" L3 @7 M& J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 A; J) F4 Z0 K3 R+ o0 t, d1 Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* {! j  F  \% j$ Y2 ]
write('</div>')/ i$ s* N8 G& R& s6 [* I+ Y& d
}
$ A/ P# p' S. p5 q" _. k! u6 P, V( Oelse if (document.layers){
6 Y& d7 `# w) F" `$ ~7 i( gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 u% P" A. I; U  B( g" d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' [$ O1 C& {6 r% r# T3 ?write('</ilayer>')+ O: ~2 n3 r1 e7 D4 x) G. j
}
; A+ w9 x7 ]% n2 f6 B3 kdocument.write('</td></table>')
! V6 o" z4 i4 j& ^" _3 N5 W6 _, V}
8 F9 v3 Y* M+ Y* l# G6 y& {}
3 l0 W! |4 Q8 a# W! N/ V</script>

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