返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- C  X  v* i1 a$ s6 zvar marqueewidth=300% U$ A- v. l0 S  q8 Q$ E6 k+ J/ S2 L1 S
//高度
7 e( k* d! ~# N, X# b1 D, K5 hvar marqueeheight=25
2 j" _( U" A9 `6 r9 z- q//速度(1-10)) g( f! Z% Y; }8 \" g
var marqueespeed=3
' f& l: [) E0 F4 N% X1 e9 Y/ l) f7 }9 [1 z//背景颜色
2 Q& B* H. m$ s: I3 _" T, w0 K  Y2 Gvar marqueebgcolor="#FFFFFF"& {3 w9 f3 l2 _9 _
//是否能暂停 (0=no. 1=yes)?; n% z' v' z- u: \9 h
var pauseit=1
% B" a- o+ f7 ^' h; A5 _8 ^$ k
3 V; R$ c4 u& @; f. [6 a' G- O//修改显示内容
" w/ b" `1 N+ e- r! Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" V9 f, h& H( B2 c+ v# u; K5 E# c2 v

, y% B$ m- l) E! x7 S% e6 b
  Y2 ^+ C/ b; v5 D////下面不需改变////////////
6 r- i1 y5 ^! E* E1 k2 H0 j* a/ c+ a+ i' z1 Q
var copyspeed=marqueespeed8 Y- e. r; z3 c9 k
var pausespeed=(pauseit==0)? copyspeed: 0+ O& M& x0 K# C
var iedom=document.all||document.getElementById+ h0 J/ K; P' ^7 @5 I6 {
if (iedom)# @- B- k) l) i/ ~% E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ Z. h. e# {% `% G+ fvar actualwidth=''3 y* f  ?" g8 e! D4 u* U# @
var cross_marquee, ns_marquee
& X5 O7 e7 ^: n$ h; }( |+ t0 h- D5 U7 V
function populate(){; |5 d8 x& ?- t, L
if (iedom){
" f7 o- n! N. j7 O4 ^- jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ U) _, G9 {0 m3 [0 p! o; Scross_marquee.style.left=marqueewidth+8
9 p( \# a; _1 L4 Rcross_marquee.innerHTML=marqueecontent0 `; m# p- z& q( n5 S
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- W. X; T8 t8 Y2 s+ M1 n. C" j
}
; D' Q& V/ A0 m/ k+ zelse if (document.layers){5 p+ H# l6 S, b0 T8 |$ r- P/ y
ns_marquee=document.ns_marquee.document.ns_marquee2
$ T2 \9 \1 ^* v6 vns_marquee.left=marqueewidth+8
& y3 N3 _8 j) M& P7 @, Rns_marquee.document.write(marqueecontent)7 U7 W2 L% o. _$ I  t! L; |
ns_marquee.document.close()
; K8 k& `- q" d2 `2 c7 iactualwidth=ns_marquee.document.width+ m: Q. b+ K- z4 J
}1 A9 x' P$ l9 p: q' N
lefttime=setInterval("scrollmarquee()",20)
7 N, Z0 K2 X4 C}
1 I9 u" v2 _- m' x: B8 O! F% A( Q7 {window.onload=populate
( V# _% W' d1 j. ~) S" ?, b" x3 d/ Q
function scrollmarquee(){: @9 N% Y/ p6 |5 M* E
if (iedom){
. I  C2 V! W- Z+ |1 Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); b. W; e* F9 U- z0 F" W1 s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 p' l. |) D  _9 w, [, D  r9 L2 C# o
else
( s& ~) X. m; v4 |2 Bcross_marquee.style.left=marqueewidth+8
* X+ o: u+ P  o6 p' T
; C4 Z9 J4 d5 V* f9 s) f0 b}
6 c/ c1 U  c+ X2 H% z* j2 i/ [else if (document.layers){& Y! {9 H8 G7 U8 B; d' Q
if (ns_marquee.left>(actualwidth*(-1)+8))" b; ]+ S# ]9 ]- m/ z+ z3 Y6 g
ns_marquee.left-=copyspeed2 ?; h* P2 @# L6 H
else
2 g4 P& @5 [7 r. P2 Fns_marquee.left=marqueewidth+8
( }0 K0 e  ^# V( k- Z1 O}
3 O- x# c7 _4 ~9 T3 B, W" m}, [5 K: P0 W2 V/ R" p
; A' O' f) L0 F+ a9 W2 Z# o/ C
if (iedom||document.layers){* a$ M. _, V2 S
with (document){6 {1 n( p  _5 N; W* P6 G5 j. A# }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): e7 p/ J$ {: q" k/ J  Q
if (iedom){
% N5 d: `$ l) B% l) Q; ~. j, @$ vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). U1 |6 ^/ a. p# I) x& t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); A% m4 _8 O: u% j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 @! P  W/ b* `; ]
write('</div>')
4 k) ?& R' u% R  B  ]5 k}
6 m0 y) M7 \- D+ A5 relse if (document.layers){
, X( ?6 W1 ]0 U8 A. H- q& R0 w# m- |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ [: r$ G" m. O; ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- U4 R& u! @, i; R" E/ pwrite('</ilayer>'): t8 J5 m  ]5 c7 y: o
}& L( `* O' Q# i1 F( W0 K$ b" |5 {
document.write('</td></table>')- G; {( S. |! P  U! v) T/ g. v7 t
}, v( ~; x1 L6 U( E
}
- U" U9 P- R8 `- r</script>

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