返回列表 发帖

网页之跑马灯文字特效

//修改宽度; Q) _: f( v* C* h
var marqueewidth=300
! r7 m8 P& n; ~. G8 u4 d* \- v//高度
6 U8 ?) H- k2 Xvar marqueeheight=25% b2 f7 l- p) G4 E* f3 Z+ F- s8 I
//速度(1-10)
& m  B5 R  B0 m+ L2 K8 fvar marqueespeed=35 h2 \3 X* D0 }) P. Z
//背景颜色- z5 ?: e: J. J& [# {& O; J) b! B
var marqueebgcolor="#FFFFFF"
- I% v) J6 [# {//是否能暂停 (0=no. 1=yes)?
- |& r7 j6 |! P: b  w, Jvar pauseit=1  F: Z. f& k' c# o% j4 N+ ]

, H0 T+ N; x6 }  u//修改显示内容
4 ]3 @6 l" x2 G' G6 {% }; J' Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 B: [* H5 }8 @0 B

+ W9 h1 _' W6 s. o& Y+ I4 F* @- c+ j$ ^9 O2 O* x
////下面不需改变////////////2 {) ~& u" i1 s  R2 F) Q* x$ ]

; B3 e! K& C8 t7 w; Dvar copyspeed=marqueespeed
- }( ?! p7 h, l& R9 w2 [/ |var pausespeed=(pauseit==0)? copyspeed: 0
. }. {, t, H. t+ \var iedom=document.all||document.getElementById* R( w2 F4 E. m- c3 S
if (iedom)
) J# x4 N; ~+ l4 B/ adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 W, r. s( k. K6 Z6 R4 Bvar actualwidth=''9 c, q2 m3 d# q9 e8 H
var cross_marquee, ns_marquee
+ P- @) C# e/ g, I4 n7 h% [
, M+ |# N" H( ~function populate(){, s, f" U% _: I8 f
if (iedom){; ~  T5 z3 @7 N. v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" u7 Y7 m( d( D9 s; xcross_marquee.style.left=marqueewidth+8+ B9 c. S5 i. \2 z7 P& l
cross_marquee.innerHTML=marqueecontent; N- _( ~/ @1 e! h, A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; ~  i: z9 O" k* I# g}
1 G' ?1 i# ?9 ]; A# Q5 k6 J& V( c! _9 Nelse if (document.layers){
- n" c; X! g" O' l1 Wns_marquee=document.ns_marquee.document.ns_marquee2
/ G2 W) P, A$ D$ c- W* M; U2 fns_marquee.left=marqueewidth+8
7 l' i5 {1 I* [8 }5 ]' vns_marquee.document.write(marqueecontent)
! S& c& V( Y4 Z7 i# ~& [ns_marquee.document.close()9 L5 T7 ~% }3 x9 F8 N: t
actualwidth=ns_marquee.document.width
. s8 f* G  k% c0 ^, z8 x}6 v, @# D5 W3 d0 @
lefttime=setInterval("scrollmarquee()",20)
$ p4 B& L: @, C4 L, ^}
: t( `6 Y/ L* k/ X/ \window.onload=populate+ K6 n3 ^3 j0 E. ]4 L+ `4 |
2 ~! c2 a6 d$ k3 b* o3 Q
function scrollmarquee(){
/ I! n) l. Q6 ]& Bif (iedom){
+ r- T* U/ U9 x0 H) `6 R0 Q6 Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# u4 n2 G7 L, q  F" M/ w4 Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) X1 g: \* {6 K! N1 Aelse
9 B- _1 l5 z% S- I" V  }# z$ |cross_marquee.style.left=marqueewidth+8
# o6 r, p" [. T* q/ j0 W# G8 c* n  J# p) n. j
}0 N5 R- `! }4 x. V7 D8 L
else if (document.layers){
" \/ R1 e" t. |) H2 C: i7 Nif (ns_marquee.left>(actualwidth*(-1)+8))5 k6 v+ w$ D9 d" b7 a: p1 [$ }& X
ns_marquee.left-=copyspeed
& i( j. R9 E5 B& @else
' N; Z# b7 A1 \  xns_marquee.left=marqueewidth+8
; y; ?- B) |% G7 W}3 K, i) N# w9 m+ ^) K8 }) W5 O
}
5 ?: v: P& |, A) f6 ^7 n
# Z$ s8 i5 B( Mif (iedom||document.layers){$ o' ^( \) A2 Q/ s- u
with (document){
3 T% i. ^* B5 P& J% Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! W: X9 d. s) n! F
if (iedom){4 T- ~2 ~6 }3 p, Q1 Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 \/ n& u! Y, b* qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- \  ^7 \( u' c" g% w$ lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& F+ j# }: Z- ?- Z4 e
write('</div>')( q* L& W$ h( n" x- C. o
}
. \! _. w! @. u; Relse if (document.layers){
# H$ Q/ {* I- u1 b; y; vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ R0 k, J1 B9 Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ O: ~4 [# W* Q5 dwrite('</ilayer>')4 P0 D" j! d/ A
}
0 h. E( P  b) _7 X' Rdocument.write('</td></table>')
% {1 n% L7 I/ E% Z( _: R! Q}: H  D  W" ?; y
}9 J+ H9 O- q, w5 A
</script>

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