返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 l- k  C, D6 V* F1 G5 F4 Evar marqueewidth=300
. q: |6 y0 V- n! w0 e! ~. M//高度
0 D- ?' Y. W1 ?0 V, ]; m. svar marqueeheight=25/ C& Z. _5 A- H) c$ ~  ^
//速度(1-10)7 c* G$ i' |: `/ {1 f6 e( T
var marqueespeed=3  |; f4 j( \5 Y
//背景颜色
; ?, y  x, w: Q& vvar marqueebgcolor="#FFFFFF"& _' [; g( }* R) |8 `: h% f5 `+ T
//是否能暂停 (0=no. 1=yes)?
& d# Y& b! i' W! M! p/ q( ~2 Nvar pauseit=1
9 `* L* @' A" f5 v. t% W
: c* y+ O8 T3 Z. p# {//修改显示内容1 N3 @+ V/ p& ]* q  K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. e5 F9 e4 j) Q9 v+ T: |! ]! K
0 n# u7 d% l1 `- Q8 {+ D+ g( q1 v! y) w& Z) z; Q- f
////下面不需改变////////////
- q4 j) B# L7 z9 o" U1 N* S1 Z5 @/ y7 N. _8 \6 T( Y: N! x
var copyspeed=marqueespeed0 c. S8 d: G2 N9 E1 B8 C
var pausespeed=(pauseit==0)? copyspeed: 0( l' i! \# G2 r8 X7 Q  D& @+ a. R
var iedom=document.all||document.getElementById# {/ f% ~; K. a& X* e$ r
if (iedom)
* s  E7 S. y/ n9 W: a5 Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 S; _7 J: J+ M( Yvar actualwidth=''
9 W  K- \0 Q. V) w; ?3 j, \var cross_marquee, ns_marquee0 p, X$ y- a; V! Y# ]7 k

( ~# k; o" a  [* K( ?function populate(){
0 t2 D8 S6 v! @/ U, |9 mif (iedom){* I6 {% j6 }* n; U8 f! k: o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, S$ G0 ?% C( \' H3 [0 C9 A
cross_marquee.style.left=marqueewidth+8
8 F' U+ `" b1 q( I, @8 kcross_marquee.innerHTML=marqueecontent5 F8 e4 o9 x( G: l4 H) k2 q# W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& r1 A; C4 J8 h- N; Y: v}
# H, p. Q" k# |! M. }( n, ~else if (document.layers){
: Q8 B' S# S6 K1 ?! tns_marquee=document.ns_marquee.document.ns_marquee2
/ a, z* M2 M# m5 ^* Mns_marquee.left=marqueewidth+8; j3 m% C9 ]: }& j
ns_marquee.document.write(marqueecontent)
' F$ e/ k$ N) @7 Y$ ^ns_marquee.document.close()
/ Q, X8 f; \( g  Eactualwidth=ns_marquee.document.width, G$ u% Y& _# {) [$ ?4 ~- }
}3 [# Q: B: z, W0 t; T* b% q/ J
lefttime=setInterval("scrollmarquee()",20)
! R! F& H5 r  \, L: o' K# t}
+ A7 F* O, _. k& kwindow.onload=populate
% x- {" }: _$ C" W+ O0 |) h" H0 b% ^4 v) l1 }
function scrollmarquee(){5 G& u$ E2 [* o, R  O* }
if (iedom){
# I5 A$ h, m. a9 fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 Y8 |, d! M) M3 [' Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 A2 |% x. p/ A4 r& s9 q' i& [  U
else
1 [8 V$ j8 G8 |# _& Pcross_marquee.style.left=marqueewidth+8
8 l$ [. {+ x: s8 q& f
$ w& |! l# l  P, W9 Q- ]}
' p; m! H  \5 p" t# n) a* gelse if (document.layers){% x( r- B; N% I, V2 T. K& ~
if (ns_marquee.left>(actualwidth*(-1)+8))/ w; `" u; E9 e5 x: m! `% _5 P
ns_marquee.left-=copyspeed
/ ~  D; h7 u) \2 B( L- m5 W! ielse. k4 s& I! Q9 E( X
ns_marquee.left=marqueewidth+8( n7 ~# |1 f8 |
}3 T/ ~8 q8 C; u4 d' U  L
}+ m# A" Z" @" d0 N

# N# N0 t8 {5 [, iif (iedom||document.layers){3 S2 }* d4 U$ R4 P; ~
with (document){  K- J- N: L: f4 z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  w0 f. n9 G4 q( mif (iedom){) X8 S8 J* K7 b4 ]. g( Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  h7 V! C5 L' E, o$ W: x7 Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 A  K9 ?8 E6 ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 V6 g! v$ F% ~/ r* d0 R
write('</div>')4 \: T/ t1 R. b( h- H
}' P% V* f! W: I4 H% f8 V3 Q
else if (document.layers){
+ B7 V+ Y/ a. K; F/ G4 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  `( f: e4 U6 b9 o4 K* ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 m; r# }( i( Awrite('</ilayer>')
! O9 f: J/ m, w! ?# [}
& I8 O! q3 u% t) m. r2 N# H1 J$ F/ ?% udocument.write('</td></table>')
" R) A' V! |/ ^}
/ ?$ s4 f! M( @8 N$ G/ Q" |* G}
+ E  e/ O, o0 M" ~5 b</script>

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