返回列表 发帖

网页之跑马灯文字特效

//修改宽度% J* [% g% x' H' u; R7 n. z
var marqueewidth=300
5 @4 {3 S. @, r7 {! [% s2 I//高度
0 H3 o2 S+ P+ d" E# _var marqueeheight=25. v' @4 s5 [3 R' v7 V2 T, g
//速度(1-10)$ Y' ?$ V1 M7 G% J
var marqueespeed=3
8 b! e% b: n5 ?$ a# i& X//背景颜色: e* o. V3 J) w; Y
var marqueebgcolor="#FFFFFF"
3 D- V+ M. F5 |//是否能暂停 (0=no. 1=yes)?. j) z) l2 [: e7 M8 J, A
var pauseit=1
* a4 k' _$ y! p1 v! `/ |0 M2 n" o8 M. i: V+ m' W
//修改显示内容5 ^+ X3 d" n# o' f( l2 ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" n  n7 {% F7 f; w% j" t" r5 k9 u# \- q, X& t) z# `0 i
! o. W2 E, r; O( |, ], A: l
////下面不需改变////////////$ D' J- A2 p2 @  L! u
0 W4 W# f: q, G  S* i7 z/ @
var copyspeed=marqueespeed
# P8 b8 c' R, s' M. f6 C. \- qvar pausespeed=(pauseit==0)? copyspeed: 02 ?; j, H8 g% d. `
var iedom=document.all||document.getElementById
8 S/ J. Y! }# \- Y( y( M+ j( x9 Oif (iedom)
3 b& y+ V( `$ E, K5 |& c% [1 Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" K8 l  `% u5 R5 F3 ^% Ovar actualwidth=''
& Z9 U% K: ]/ F: j: ~! Vvar cross_marquee, ns_marquee
# `; ]) @9 h( O* y9 O& Y: M+ l, e5 @0 N( ?% T0 q# G8 W
function populate(){" B2 @# ~. H% I0 Z% M0 C
if (iedom){
% C" H  G" P+ q: w# lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) h! o- W  L' A& t( Ccross_marquee.style.left=marqueewidth+8
: J( E. c- C# B+ Y+ h+ a/ q$ K. S  scross_marquee.innerHTML=marqueecontent; O* y5 Z# m9 b, W: t+ `- ?7 k; d" b$ V: Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& d7 P6 b- s4 ^, k) E}
/ a7 C( M0 t5 X- t; Yelse if (document.layers){5 N/ y7 E3 V% X# N4 g4 j
ns_marquee=document.ns_marquee.document.ns_marquee2
/ Y; B  |, x& r2 T' ?. r  zns_marquee.left=marqueewidth+83 Y6 n, ]+ N2 M
ns_marquee.document.write(marqueecontent)7 x& @- H5 @) ~* M5 e
ns_marquee.document.close()7 P/ V- M: q6 g* ~6 k3 b: ~
actualwidth=ns_marquee.document.width8 }, N# U  |- U
}
# p* m* E2 d% ~6 a' I! x4 h. Nlefttime=setInterval("scrollmarquee()",20)
0 C0 B* g/ @: X% o# T( J}
) Z: u0 O  \+ |$ t0 Hwindow.onload=populate
, M. ?4 Q' [: Z# z! l
0 |: J6 U4 m2 [) [" z& ifunction scrollmarquee(){2 \: ]5 N5 X* z2 S2 k7 w
if (iedom){) ]0 P. j6 K! L' d4 W$ F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): d, q% E0 T/ w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, f- b5 j/ a2 W- t. ^+ ?. q
else0 _9 P7 F9 {: Z( b2 J, o
cross_marquee.style.left=marqueewidth+80 K3 o1 ^1 |/ E2 z* C# w
6 a! Z, i+ L1 r  L: k* ?( o
}
( o8 A% H, G  e) I8 V9 L2 v. |! qelse if (document.layers){  B; n9 l6 Z' w) N# x% Y
if (ns_marquee.left>(actualwidth*(-1)+8))
; f! ?5 g, f9 {0 V4 ~4 s  g" X9 tns_marquee.left-=copyspeed
3 H' |2 D: X) R. telse8 a- {' L; j! E: i) e+ w2 E% ^2 I
ns_marquee.left=marqueewidth+8
$ \* G0 N/ W3 v: z4 ^2 Q}0 W1 o+ Q  W5 l; [) T2 M8 x
}
( k: W; u! N' D* d( L: X" Z! N' w# j0 y
if (iedom||document.layers){
2 H4 w% a! W4 ^2 R7 ]: R9 ewith (document){! G% w; A& t" ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 m) O! V/ W+ a7 b4 @( n
if (iedom){
0 O5 u9 |# u- B: p- [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 N1 o  r! f; Q! j1 b2 |! Q( M* {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ U+ n  v# ?4 B( b; {4 {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 f. Q. k7 A6 g6 D2 iwrite('</div>')
5 z1 @  G7 L. U9 @4 H! t}3 A3 E" n/ }; K/ _; c9 j6 o7 o
else if (document.layers){9 u+ G/ h0 [+ |5 X7 v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 x5 U1 n4 X1 |3 \& w1 Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: ]7 j! x7 B% b  @0 G! lwrite('</ilayer>')( }& ?. ~, v! N1 w1 c6 J
}& T1 |: r! O$ @& [7 f- m
document.write('</td></table>'). D, C" B& n' x6 m
}. E8 d( w+ J2 k/ p# M
}
5 _/ |* o/ i% W! s</script>

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