|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度# K' r' f$ ^% {! ^: S. {
var marqueewidth=3002 {! `. S" R. V* j: h
//高度
& P1 L- B: z q+ v: z7 \var marqueeheight=25" W' _. u7 Y d% {) R5 m$ ^
//速度(1-10)
: z% @! ^% d" ~/ zvar marqueespeed=3
. K) q1 w$ s8 r+ y//背景颜色! ] Q6 l# I* r+ y# t; g% |7 P
var marqueebgcolor="#FFFFFF"
! `1 K2 @/ _ y3 q$ H/ I+ O! }3 i$ ~4 l//是否能暂停 (0=no. 1=yes)?
" X1 `1 y7 W) n* `var pauseit=1
# Q) T/ N% }3 Y' w4 o6 G' r
, j }8 c& O" t W//修改显示内容
! {( G9 r8 ~) R6 k( o! O1 _" Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( B s% J: X& [8 X" a
$ q0 T; U( H7 O; T& F0 s
[/ b8 t+ t9 ~6 [+ ?* f7 l7 f
////下面不需改变////////////
7 R2 ]# X9 V+ U, k- z7 O7 ?% i3 W( y% K- P0 V
var copyspeed=marqueespeed( V0 g4 h) q7 l: T& i* \- F/ }
var pausespeed=(pauseit==0)? copyspeed: 0: D. K5 [2 K3 t- K
var iedom=document.all||document.getElementById
3 w) r8 d) f0 s) H* @+ P6 Q+ ?: Tif (iedom)3 Y4 k3 D4 q3 j- j8 F& ^" q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 Z% m/ z- h& Q/ q5 ~, \
var actualwidth=''4 ?0 F9 d- o0 Z9 O! I! e- v$ D
var cross_marquee, ns_marquee) C9 H( Y1 D6 W0 ]4 B6 v' q
3 Q: H! V) o: H0 b: d- e. ?function populate(){/ `4 U% m$ p( w8 G# |( R
if (iedom){) ], L6 z7 c, {2 }! ^. H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ q" G: D0 o0 I+ X7 }5 s6 A2 bcross_marquee.style.left=marqueewidth+8
' z7 ]9 m: S A& o0 Y& N6 zcross_marquee.innerHTML=marqueecontent. ?. P2 L* A& R6 A4 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% G5 U7 M( b9 d4 H6 D! D- Y
}
; `1 \. Q/ m% Pelse if (document.layers){
4 t( y0 c3 q. U+ K# ans_marquee=document.ns_marquee.document.ns_marquee2: d5 h/ S" k7 e# [2 _
ns_marquee.left=marqueewidth+81 g. ~" `8 l! \3 R
ns_marquee.document.write(marqueecontent)
3 a! M$ b" |( Rns_marquee.document.close()
. M4 T7 O0 R+ C, M, N6 qactualwidth=ns_marquee.document.width$ z7 P. F) m* A7 c
}
3 N9 {* d# `; K' f* i) r- J( qlefttime=setInterval("scrollmarquee()",20)
1 E( i8 t# J1 B- n}( A$ I9 n! r" r
window.onload=populate& u/ u# }, y7 i! ?1 D, q: X: A
; n2 u/ A$ D0 m" ]( cfunction scrollmarquee(){
: H0 ]* M0 ]% C3 aif (iedom){8 i+ E' _4 K. r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" o* M2 j! ^; ]" Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ W; k3 w% A% j* ?' W
else
0 m; }0 `% `: y }1 ncross_marquee.style.left=marqueewidth+8# [( i7 X, c& H0 c
; U( u' u1 P4 M& ?3 a4 X* Y
}
# M$ ?7 @+ q3 J8 H* H; p0 f% ?else if (document.layers){
" q1 X" W0 Z: y$ W: U5 _/ Hif (ns_marquee.left>(actualwidth*(-1)+8))1 E+ M6 n! N4 |5 O0 J% d- K
ns_marquee.left-=copyspeed' h0 `9 Y8 c1 X, H' c/ I8 O9 f$ w
else5 j' m8 L. m# _9 B; W* N; F! @3 X0 @
ns_marquee.left=marqueewidth+8
. J$ z0 w3 d5 X( w8 [' \}
' L6 H0 q4 ?1 L& I}0 S* x; M# z0 q' N- W7 z
. n5 Y& _. g4 [4 O! X0 Y# i, |if (iedom||document.layers){! D* r& r, J' c
with (document){
4 x/ I. W6 B, A7 S# [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& W( L8 R) m; f* Y& C- R
if (iedom){4 n- y2 J4 n/ _" [2 V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 P4 l. R9 B0 D" H2 `+ `9 G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ I6 ^1 K, \1 z# ]# J% f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ X# q5 ^# E9 l3 A# E. \write('</div>')
0 ]4 v1 A0 [& Y+ z- F* g}, l. F' T4 w2 L1 C
else if (document.layers){6 _1 r5 S: `! B7 u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 m9 ], }+ a, Z) W0 X. w% S& k# Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 R5 W/ Q8 M/ _1 ~& O1 awrite('</ilayer>')
0 @1 M+ y* G- g1 `8 _7 v}
$ \2 Q( h) p/ j5 ]document.write('</td></table>')6 s' d3 n+ R `) j1 H' n9 ~6 `4 O
}
7 h% y5 o( U( \2 E8 g}
% N, r8 Y/ }3 M3 |</script> |
|