返回列表 发帖

网页之跑马灯文字特效

//修改宽度! M" P) `7 d$ a6 g5 M, C$ Q1 P- N
var marqueewidth=3004 C$ F) W; o8 h) T4 e9 z5 G7 E
//高度
# {8 i" \- i" N# s4 n6 W- }0 [var marqueeheight=25
( b2 J! N/ |8 [) a//速度(1-10)
+ C' s) h7 n% a, U# Evar marqueespeed=3
' v7 D& y' c2 W4 l4 ]//背景颜色# o5 d! r5 e9 H0 }1 j4 ]5 L# D/ D
var marqueebgcolor="#FFFFFF"
6 A9 S* K8 m' K5 q- f//是否能暂停 (0=no. 1=yes)?
; ]/ z6 m. s8 }5 _, f7 {/ Z0 o5 fvar pauseit=1, S1 U) r8 {9 a( v
3 _# X, F3 |( z, g9 \- V
//修改显示内容/ P$ F3 c9 R$ w% ]" F. b7 J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; u7 d# \. h2 N7 w$ O
' j0 v  g: h( C6 Q6 R
$ \1 ?2 ?) P$ a, e- [6 |
////下面不需改变////////////1 H* ?1 ^% Q) {0 ?3 a- G8 U
- t0 }( C& E( ~4 j& S
var copyspeed=marqueespeed5 J. e7 X2 s* d* {* D" v
var pausespeed=(pauseit==0)? copyspeed: 0
7 p  p3 j6 B3 J5 ~( ]var iedom=document.all||document.getElementById+ T6 c( v/ P( ?( m
if (iedom)
, d; f" @; Q) Z$ t9 V$ J! Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 P4 t' w; A- H$ {2 b
var actualwidth=''- q" L- f9 {5 [% H' |
var cross_marquee, ns_marquee
6 ~% _5 K1 z; ?& k% L
# k' X7 q- u4 y; p& ]1 |# \; xfunction populate(){
2 X0 `" h# }8 e2 D( l( Uif (iedom){4 e  l* t( f9 V* f% R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- j1 o; K2 f. @1 ?- l2 U4 Across_marquee.style.left=marqueewidth+8
0 l3 D% u  Z( I7 J/ a4 m) vcross_marquee.innerHTML=marqueecontent6 i. J/ w( I: Y3 N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 u. k% e6 r$ S7 i0 }" N
}. W; H+ R5 |9 ]) Y2 H/ ?% a
else if (document.layers){! q3 u8 k/ {8 H/ z& d
ns_marquee=document.ns_marquee.document.ns_marquee2; b, ~. u; k9 m1 o  J2 B5 ]
ns_marquee.left=marqueewidth+8
) l) Z6 o5 e) w" {, ~% xns_marquee.document.write(marqueecontent)
0 g+ L! M; V8 M9 G' F1 d, e- cns_marquee.document.close()3 f, {. d' n1 ]: g2 @9 o
actualwidth=ns_marquee.document.width
7 u3 u/ y+ ?0 G6 P}% o4 o! Z$ x- C- u0 y% C+ c
lefttime=setInterval("scrollmarquee()",20)" N/ s0 F& A' W) G' r# t- y5 R
}' n5 l2 _3 Y, w1 J0 @
window.onload=populate
& }- U! U2 L- Y, Y+ R. [& |7 _( [) {* s/ O
function scrollmarquee(){
& }) a+ f' j1 P  \" Wif (iedom){. g1 U+ ]$ p! e- M& G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ l+ A" e- Z/ d% s1 x
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; ]" {0 q6 l+ H/ w+ X# k
else/ [2 T, X4 \- [+ z9 X7 |
cross_marquee.style.left=marqueewidth+8
9 `6 d( t* y) [2 W( [& ~9 e; e, r8 C
}
( T* B! Q6 L: a* [! \* u7 nelse if (document.layers){% [4 M+ _5 B. C  ?- D
if (ns_marquee.left>(actualwidth*(-1)+8))
/ I& l" G# P: i9 p! jns_marquee.left-=copyspeed
5 Y' K5 a. o8 l: Pelse( P7 C$ [9 F  }: W: A1 b% b% r
ns_marquee.left=marqueewidth+8
' \! |( `, M) ]0 U! `2 I& {/ N}5 ^7 O; Z+ u% Q* [
}0 Y' d0 m1 M& n$ S

/ i2 e5 B9 Q8 c; w0 P5 W$ Eif (iedom||document.layers){2 Z3 q' m, g" J: p
with (document){
4 ~3 j& ]1 y% P7 [/ d. {( Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 o# _5 _, |- m* V, t4 f
if (iedom){. D+ I1 g- i( S6 K1 B" |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# [- @8 E. v$ g& `0 ?2 ?$ ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 f8 O8 n" Z$ x0 Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 H0 b" ^" I5 {; k8 O2 `% L$ F, |write('</div>')  g9 l$ a. _- a
}
" f9 y- c9 [' B' ^: x. z6 D6 [9 yelse if (document.layers){" b0 x$ z8 P$ J$ c) J2 W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 {' C7 N6 x, g& ?( M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 o" S4 ?, W, x4 y
write('</ilayer>')0 f" l7 w/ Q# z! s  D
}
+ r( @. T- _7 Y5 ]1 R7 ?document.write('</td></table>')
% n4 n9 A$ x7 [6 f: l$ B- K}
% \4 u5 @" K, y& C  A}; N; O- ~% Z; m  A- t" m
</script>

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