返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% b7 s8 i/ w' N- y* \- _var marqueewidth=300
, z/ H3 C1 d& C! ?//高度
# M; ^  L; A" dvar marqueeheight=25
7 T3 S( O  R+ |- J//速度(1-10)
5 q, L, [4 ?7 d, A/ e) }0 }var marqueespeed=39 i" A  n" @  \1 M$ y; O) C" p2 y) H
//背景颜色- Q3 t- q" X9 |+ C% F# K4 k
var marqueebgcolor="#FFFFFF"; E  ]) D; {, M; V) l5 M- B1 ]
//是否能暂停 (0=no. 1=yes)?
, \; H: u* A9 Wvar pauseit=1
/ M$ M* u7 M! V" S- m/ J4 ?$ q  `6 M. Q$ ^; ]8 F
//修改显示内容
. X; V0 l0 V: b! M9 x9 s$ T1 F1 cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  L% R/ p1 K4 \. |# j

) n$ [( T; R$ \% Z; k% u# P  l" t/ ^/ Z- a
////下面不需改变////////////
- t( n2 Q) _' c! F, M3 {# r6 y
var copyspeed=marqueespeed
. D2 T8 T8 @- a$ Lvar pausespeed=(pauseit==0)? copyspeed: 05 I, `1 B; j1 b2 t7 _0 D
var iedom=document.all||document.getElementById
' B; h* P) G$ h4 \1 P% B# |# ~if (iedom)8 c* m/ `7 ~- f. t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 w) A; I1 D/ Q% h1 a
var actualwidth=''
7 e2 A, l6 F: m4 svar cross_marquee, ns_marquee) h3 T) C9 F5 H& I* i% X! P$ Q$ S8 m6 G
! {# @! l1 o, q. `8 M+ X. H. p
function populate(){
4 p( }( Z! l3 R! N! P& o* lif (iedom){
; n% g5 m  E  O1 t0 bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 n, g8 F( L" w7 L) Rcross_marquee.style.left=marqueewidth+8
3 m  `5 L1 z# o2 Lcross_marquee.innerHTML=marqueecontent
, Y$ V1 F, [5 ?" M/ s+ q6 v0 uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- w4 X7 Y3 u3 i& C$ h& U
}
% G8 y* p3 B5 Y3 d8 Oelse if (document.layers){. X+ B5 l% k+ w7 M- F$ m
ns_marquee=document.ns_marquee.document.ns_marquee2( s2 J+ N7 \. n0 [5 |+ A- G7 U. l
ns_marquee.left=marqueewidth+8! b5 f5 [" S) Y8 `* W
ns_marquee.document.write(marqueecontent)2 d5 e! E+ S( o0 s/ f0 v" d; N$ B0 Y
ns_marquee.document.close()5 `% T. F0 Y, W  V1 u
actualwidth=ns_marquee.document.width
7 j; v3 `3 G/ _" @' ]6 q( m}
' C; g$ V9 W- X9 f: Zlefttime=setInterval("scrollmarquee()",20)
- c# P( Y7 ?8 z( F% }}8 V, m# O; }: g7 Q  o) q+ F5 B
window.onload=populate
- u; c. ?% u4 \% e3 Q9 M
& [& ]$ [0 Z  g- |  K, r0 Yfunction scrollmarquee(){
# Z0 k# Y3 C: @% Sif (iedom){
. n# G0 `! o% V# J0 W2 I; Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 {( ?0 H/ V2 |$ r2 v& \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  q8 ?1 b$ _8 v. t0 N1 m, w
else+ s3 a* G4 P/ i. H
cross_marquee.style.left=marqueewidth+82 o0 E7 _8 [9 S: F% D& q/ a# a

, R# D1 c% d0 h! T1 A: A}) ~7 Q; M: o$ w$ G
else if (document.layers){
: Y8 J0 F( e7 O. V8 [if (ns_marquee.left>(actualwidth*(-1)+8))
0 ^. q* ?; k9 `% fns_marquee.left-=copyspeed
: ?& _( k# j+ ]2 [& j6 Q" ^else9 J. \" r- z- D  t. `
ns_marquee.left=marqueewidth+8
4 q5 |+ b% R+ K4 u. d: Q}# o; f6 X+ o) u# r  D
}  ^0 t/ V7 F" U

1 c% w  P% F. T0 N4 Y/ _( X% tif (iedom||document.layers){
$ L# j' P; W8 Y' ^0 F% xwith (document){
4 Z! t$ S' k6 q& `  s5 k3 a* |/ ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& e& t1 Q( F4 a) |  p, bif (iedom){
% ~' [% Q+ m) R  Z  p7 mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; h& ]) X3 f- V! R+ o+ Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  F/ z& w* P4 bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), O5 L4 M/ h3 L0 Q6 X
write('</div>')4 x- h8 ?6 `& a2 \2 T& H% B
}
3 K2 u0 g- V, ]) x8 Oelse if (document.layers){1 ~9 g3 S( E9 S5 t$ N5 P+ j9 C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- W0 h: G8 L+ d, M5 J2 V3 q% M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 E5 M, d5 o4 Y& z2 c8 F  `9 Gwrite('</ilayer>')1 O0 |5 S, d% g1 n% V6 y
}0 {0 M; P; f8 r) O+ m& z
document.write('</td></table>')
4 s3 s# g  p. x. N# Z) c5 n}& x$ L8 z% z! s+ C. w/ \9 |% y
}
8 e  P/ A+ S; j3 J9 Q# r</script>

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