返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ W+ p( m/ @: T) p( g% ~var marqueewidth=300
9 c7 s! S; S: ^5 h" u4 L: g//高度
9 n8 v0 J4 j8 t, c! w1 fvar marqueeheight=25
1 p0 F7 ^  w9 j) A! N4 ]! w0 Q//速度(1-10)
: B1 X/ q" u5 p8 {/ Nvar marqueespeed=3
: f8 j- P/ u5 {/ g$ ?# C3 C//背景颜色) c& B( e* a. x5 n
var marqueebgcolor="#FFFFFF"
" U- O' g& o7 M9 F" t9 I4 t//是否能暂停 (0=no. 1=yes)?
7 _, |- M: D# t5 ^" ~+ C+ z' @+ Ivar pauseit=1/ Q: y  W$ q3 T; J$ v1 e
7 T- M! |# N( Q/ C. n# x, B
//修改显示内容
; N2 @! F" \: L9 h3 A: y* V6 i) Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. b1 e- y- n1 `- h! `

: n, k4 p! K7 Y* g  J  n  I0 W0 O0 z' l0 [8 ?# P
////下面不需改变////////////
. z. X! L0 f" p) v  }9 A8 [. k: a/ r/ b' V+ E, ^
var copyspeed=marqueespeed1 [9 s& z9 e8 f  o
var pausespeed=(pauseit==0)? copyspeed: 07 A; y- g+ q; @7 c$ d
var iedom=document.all||document.getElementById
! y0 [. A2 }/ H: r" [if (iedom)' m* u1 P% o) G& f7 V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ C2 L) D9 x) ?4 q7 t7 Kvar actualwidth=''
; V5 N7 D- k0 y+ R" U" n, [6 I& R: dvar cross_marquee, ns_marquee
+ a( B- I4 E$ F" s
5 g1 Y: C3 k% H- V6 f2 U: Cfunction populate(){
6 F: g. R) l" w/ E7 lif (iedom){
# e8 Q" J0 F) Y# Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) C9 ?6 b4 f. Y) ^9 t! }3 Q
cross_marquee.style.left=marqueewidth+8
7 q+ Y* r3 D5 Ncross_marquee.innerHTML=marqueecontent
5 J. q5 A7 q$ m) Q$ V  c( Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- ], Y9 e, {  ]0 k$ ~: ]}
! h. K" B- g2 O" X0 q3 E' _! felse if (document.layers){/ m/ u% [! Y  P" |* t0 L
ns_marquee=document.ns_marquee.document.ns_marquee23 v) d9 I* g+ R" v7 C
ns_marquee.left=marqueewidth+8. q5 K# w0 `0 t' b. N, R) A
ns_marquee.document.write(marqueecontent)
8 ]# M6 V  u, hns_marquee.document.close()5 X: Z2 e0 x+ V& ?! }- I
actualwidth=ns_marquee.document.width/ t; z. `* ^* Z; z9 m% @
}
6 w, n7 x; S4 t3 L6 `lefttime=setInterval("scrollmarquee()",20)# d6 o9 D7 h% T: A6 v
}
( g3 |) X2 H9 z  X; l( G4 g+ twindow.onload=populate
: X# H; k0 P* V$ C
8 `+ @/ P  _0 I: n" mfunction scrollmarquee(){
5 f1 C" ]1 r' Z( Y, F; Iif (iedom){
+ \$ z2 p& n) Q% g+ T# Q* Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ ~- q* m( p) T$ N& x/ {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. E( o8 n& a$ {
else
* d& q+ ?2 i0 N$ W9 P" H- Ncross_marquee.style.left=marqueewidth+8
: {! O- N6 k$ r
0 O  R9 G. A3 }5 W: W5 e3 ^( M, X}& A- C; }: K9 w5 X; L* O, D
else if (document.layers){' A7 ^) g5 A  I+ U
if (ns_marquee.left>(actualwidth*(-1)+8))
) ^5 A+ J' u- Z$ U. mns_marquee.left-=copyspeed
4 {& o0 `8 X. o  Lelse5 o7 r- W$ S5 [& E
ns_marquee.left=marqueewidth+8
/ i3 I+ x7 @" P' E3 j}/ e& N: W9 U; ^" T" V
}! s$ X0 I3 R. H1 w8 @0 P$ b, I- Z

2 x, P8 d! q9 v. K4 fif (iedom||document.layers){
$ A  A( N# A# B6 c" mwith (document){1 v1 P! H3 g3 c1 k. B7 h
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ `  l9 z( j4 ^2 ^9 h4 p# ~if (iedom){' I- X9 b" ]# {" F1 M6 q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- O2 o% i8 D5 M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ u' ]7 \/ K, H8 ]. W2 \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ P) }( a4 u* q2 Q9 \5 ywrite('</div>')- ]2 h/ W' g* d1 X+ Q" d8 @
}
, A- {: l6 L& J( Q/ n& l4 p- telse if (document.layers){
+ i7 f/ x7 G4 Z3 M+ f  p$ \4 P; Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" O; Y" @) ]0 m2 b) r3 y( cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; t1 `( M: t$ d- @% r! }/ Iwrite('</ilayer>'), R4 G6 w; ?- p3 q6 j' `" n
}
' U$ G: s3 D7 v* z& Tdocument.write('</td></table>'), B. r' @+ h/ z
}
# g" k& j# i# H$ U2 ?$ T5 _/ j}
- g& c: b% Q0 `( x% Q</script>

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